diff options
Diffstat (limited to 'lib/yahns')
-rw-r--r-- | lib/yahns/client_expire.rb | 10 | ||||
-rw-r--r-- | lib/yahns/config.rb | 1 | ||||
-rw-r--r-- | lib/yahns/fdmap.rb | 4 |
3 files changed, 7 insertions, 8 deletions
diff --git a/lib/yahns/client_expire.rb b/lib/yahns/client_expire.rb index 7da9498..c35f63f 100644 --- a/lib/yahns/client_expire.rb +++ b/lib/yahns/client_expire.rb @@ -12,18 +12,18 @@ module Yahns::ClientExpire # :nodoc: return 0 if closed? # still racy, but avoid the exception in most cases info = Raindrops::TCP_Info.new(self) - return 0 if info.tcpi_state != 1 # TCP_ESTABLISHED == 1 + return 0 if info.state != 1 # TCP_ESTABLISHED == 1 # Linux struct tcp_info timers are in milliseconds timeout *= 1000 - send_timedout = !!(info.tcpi_last_data_sent > timeout) + send_timedout = !!(info.last_data_sent > timeout) # tcpi_last_data_recv is not valid unless tcpi_ato (ACK timeout) is set - if 0 == info.tcpi_ato - sd = send_timedout && (info.tcpi_last_ack_recv > timeout) + if 0 == info.ato + sd = send_timedout && (info.last_ack_recv > timeout) else - sd = send_timedout && (info.tcpi_last_data_recv > timeout) + sd = send_timedout && (info.last_data_recv > timeout) end if sd shutdown diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb index 1d4d110..d38c090 100644 --- a/lib/yahns/config.rb +++ b/lib/yahns/config.rb @@ -225,7 +225,6 @@ class Yahns::Config # :nodoc: # global def client_expire_threshold(val) var = _check_in_block(nil, :client_expire_threshold) - val > 0 or raise ArgumentError, "#{var} must be > 0" case val when Float val <= 1.0 or raise ArgumentError, "#{var} must be <= 1.0 if a ratio" diff --git a/lib/yahns/fdmap.rb b/lib/yahns/fdmap.rb index 0272421..1e1677a 100644 --- a/lib/yahns/fdmap.rb +++ b/lib/yahns/fdmap.rb @@ -12,8 +12,8 @@ class Yahns::Fdmap # :nodoc: if Float === client_expire_threshold client_expire_threshold *= Process.getrlimit(:NOFILE)[0] - elsif client_expire_treshhold < 0 - client_expire_threshold = Process.getrlimit(:NOFILE)[0] - + elsif client_expire_threshold < 0 + client_expire_threshold = Process.getrlimit(:NOFILE)[0] + client_expire_threshold end @client_expire_threshold = client_expire_threshold.to_i |