1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/net-http] Revert "Replace Timeout.timeout in Net:HTTP#connect"

This reverts commit https://github.com/ruby/net-http/commit/753cae3bbccc.

https://github.com/ruby/net-http/commit/98caa38204
This commit is contained in:
Hiroshi SHIBATA 2022-10-21 21:33:50 +09:00 committed by git
parent e026368061
commit f88bff7705

View file

@ -1013,13 +1013,14 @@ module Net #:nodoc:
end
debug "opening connection to #{conn_addr}:#{conn_port}..."
begin
s = Socket.tcp conn_addr, conn_port, @local_host, @local_port, connect_timeout: @open_timeout
rescue => e
e = Net::OpenTimeout.new(e) if e.is_a?(Errno::ETIMEDOUT) #for compatibility with previous versions
raise e, "Failed to open TCP connection to " +
"#{conn_addr}:#{conn_port} (#{e.message})"
end
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
begin
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
rescue => e
raise e, "Failed to open TCP connection to " +
"#{conn_addr}:#{conn_port} (#{e.message})"
end
}
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
debug "opened"
if use_ssl?