[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:
parent
e026368061
commit
f88bff7705
@ -1013,13 +1013,14 @@ module Net #:nodoc:
|
|||||||
end
|
end
|
||||||
|
|
||||||
debug "opening connection to #{conn_addr}:#{conn_port}..."
|
debug "opening connection to #{conn_addr}:#{conn_port}..."
|
||||||
begin
|
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
|
||||||
s = Socket.tcp conn_addr, conn_port, @local_host, @local_port, connect_timeout: @open_timeout
|
begin
|
||||||
rescue => e
|
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
|
||||||
e = Net::OpenTimeout.new(e) if e.is_a?(Errno::ETIMEDOUT) #for compatibility with previous versions
|
rescue => e
|
||||||
raise e, "Failed to open TCP connection to " +
|
raise e, "Failed to open TCP connection to " +
|
||||||
"#{conn_addr}:#{conn_port} (#{e.message})"
|
"#{conn_addr}:#{conn_port} (#{e.message})"
|
||||||
end
|
end
|
||||||
|
}
|
||||||
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
||||||
debug "opened"
|
debug "opened"
|
||||||
if use_ssl?
|
if use_ssl?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user