mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
Do not save the last error without sockets in the connection attempt (#12153)
* Do not save the last_error if there are no sockets waiting to be connected In this implementation, the results of both name resolution and connection attempts are awaited using select(2). When it returned, the implementation attempted to check for connections even if there were no sockets currently attempting to connect, treating the absence of connected sockets as a connection failure. With this fix, it will no longer check for connections when there are no sockets waiting to be connected. Additionally, the following minor fixes have been made: * Handle failure of getsockopt(2) and removed unnecessary continue in the loop * Tweak: Use common API to check in_progress_fds * Safely call TCPServer.new in test * Set empty writefds when there is no socket waiting to be connected * Enable fast_fallback option
This commit is contained in:
parent
b305df8c78
commit
ff5fc4b5a1
Notes:
git
2024-11-25 05:11:12 +00:00
Merged-By: shioimm <shioi.mm@gmail.com>
3 changed files with 86 additions and 59 deletions
|
@ -142,7 +142,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_v6_hostname_resolved_earlier
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
begin
|
||||
|
@ -167,7 +167,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_v4_hostname_resolved_earlier
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
server = TCPServer.new("127.0.0.1", 0)
|
||||
|
@ -188,7 +188,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_v6_hostname_resolved_in_resolution_delay
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
begin
|
||||
|
@ -214,7 +214,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_v6_hostname_resolved_earlier_and_v6_server_is_not_listening
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
ipv4_address = "127.0.0.1"
|
||||
|
@ -237,7 +237,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_v6_hostname_resolved_later_and_v6_server_is_not_listening
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
ipv4_server = Socket.new(Socket::AF_INET, :STREAM)
|
||||
|
@ -263,7 +263,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_v6_hostname_resolution_failed_and_v4_hostname_resolution_is_success
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
server = TCPServer.new("127.0.0.1", 0)
|
||||
|
@ -284,10 +284,15 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_resolv_timeout_with_connection_failure
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
server = TCPServer.new("::1", 0)
|
||||
begin
|
||||
server = TCPServer.new("::1", 0)
|
||||
rescue Errno::EADDRNOTAVAIL # IPv6 is not supported
|
||||
exit
|
||||
end
|
||||
|
||||
port = server.connect_address.ip_port
|
||||
server.close
|
||||
|
||||
|
@ -303,7 +308,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_with_hostname_resolution_failure_after_connection_failure
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
begin
|
||||
|
@ -325,7 +330,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_with_connection_failure_after_hostname_resolution_failure
|
||||
pend "to suppress the output of test failure logs in CI temporarily"
|
||||
# pend "to suppress the output of test failure logs in CI temporarily"
|
||||
return if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
||||
|
||||
server = TCPServer.new("127.0.0.1", 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue