tcp-timeout-ruby icon indicating copy to clipboard operation
tcp-timeout-ruby copied to clipboard

Only support read_time and write_timeout, connect_timeout not raise connect error

Open YaEvan opened this issue 3 years ago • 0 comments

connect_timeout raise SocketTimeout, "#{type} timeout" only read timeout/ write timeout def select_timeout(type, timeout) if timeout >= 0 if type == :read read_array = [@socket] else write_array = [@socket] end start = Time.now if IO.select(read_array, write_array, [@socket], timeout) waited = Time.now - start return timeout - waited end end raise SocketTimeout, "#{type} timeout" end

YaEvan avatar Apr 13 '21 02:04 YaEvan