Skip to content
  • Misaki Shioi's avatar
    fd4b2747
    Do not wait connection attempt delay without in progress fds (#12087) · fd4b2747
    Misaki Shioi authored
    Do not wait Connection Attempt Delay without in progress fds
    
    Reset Connection Attempt Delay when connection fails and there is no other socket connection in progress.
    This is intended to resolve an issue that was temporarily worked around in Pull Request #12062.
    
    `TCPServer::new` (used in tests such as `TestNetHTTP_v1_2_chunked#test_timeout_during_non_chunked_streamed_HTTP_session_write`) can only connect over either IPv6 or IPv4, depending on the environment.
    Since HEv2 attempts to connect over IPv6 first, environments where IPv6 connections are unavailable return ECONNREFUSED immediately.
    In such cases, the client should immediately retry the connection over IPv4.
    However, HEv2 includes a specification for a "Connection Attempt Delay," where it waits 250ms after the previous connection attempt before starting the next one.
    This delay causes Net::OpenTimeout (100ms) to be exceeded while waiting for the next connection attempt to start.
    
    With this change, when a connection attempt fails, if there are sockets still attempting to connect and there are addresses yet to be tried, the Connection Attempt Delay will be resetted, allowing the next connection attempt to start immediately.
    
    ---
    
    Additionally, the following minor fixes have been made:
    
    - The `nfds` value used for select(2) is now reset with each wait.
    fd4b2747
    Do not wait connection attempt delay without in progress fds (#12087)
    Misaki Shioi authored
    Do not wait Connection Attempt Delay without in progress fds
    
    Reset Connection Attempt Delay when connection fails and there is no other socket connection in progress.
    This is intended to resolve an issue that was temporarily worked around in Pull Request #12062.
    
    `TCPServer::new` (used in tests such as `TestNetHTTP_v1_2_chunked#test_timeout_during_non_chunked_streamed_HTTP_session_write`) can only connect over either IPv6 or IPv4, depending on the environment.
    Since HEv2 attempts to connect over IPv6 first, environments where IPv6 connections are unavailable return ECONNREFUSED immediately.
    In such cases, the client should immediately retry the connection over IPv4.
    However, HEv2 includes a specification for a "Connection Attempt Delay," where it waits 250ms after the previous connection attempt before starting the next one.
    This delay causes Net::OpenTimeout (100ms) to be exceeded while waiting for the next connection attempt to start.
    
    With this change, when a connection attempt fails, if there are sockets still attempting to connect and there are addresses yet to be tried, the Connection Attempt Delay will be resetted, allowing the next connection attempt to start immediately.
    
    ---
    
    Additionally, the following minor fixes have been made:
    
    - The `nfds` value used for select(2) is now reset with each wait.
Loading