Skip to content
  • rswindell's avatar
    Bug-fix: Socket.connect() would return true (success) even though a · 7685c9d7
    rswindell authored
    TCP connection actually failed. This bug only appeared to affect *nix
    systems. This bug appears to be very old, introduced in rev 1.74 of
    this file (Mar-2003) by yours truly.
    From the Linux 'connect' man page:
    EINPROGRESS
                  The  socket  is  nonblocking  and the connection cannot be i
                  completed immediately.  It is possible to select(2) or poll(2)
                  for completion by selecting the socket for writing.  After
                  select(2) indicates writability, use getsockopt(2) to read the
                  SO_ERROR option at level SOL_SOCKET to determine whether
                  connect() completed successfully (SO_ERROR is zero) or
                  unsuccessfully (SO_ERROR is one of the usual error codes listed
                  here, explaining the reason for the failure).
    
    We weren't doing the 'getsockopt(SO_ERROR)' part.
    7685c9d7