Skip to content

Commit

Permalink
test: windows: Add warnings for linger_timeout to be greater than 65536
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmo0920 committed Mar 6, 2020
1 parent 7d16531 commit 73a2322
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/fluent/plugin_helper/socket_option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def socket_option_set(sock, resolve_name: nil, nonblock: false, linger_timeout:
# This unintented behavior causes "Errno::ECONNRESET: An existing connection was forcibly
# closed by the remote host." on Windows.
if linger_timeout.to_i > 0
if linger_timeout >= 2**16
log.warn "maximum linger_timeout is 65535(2^16 - 1). Set to 65535 forcibly."
linger_timeout = 2**16 - 1
end
optval = [1, linger_timeout.to_i].pack(FORMAT_STRUCT_LINGER_WINDOWS)
socket_option_set_one(sock, :SO_LINGER, optval)
end
Expand Down

0 comments on commit 73a2322

Please sign in to comment.