Keep some state about the connections we're monitoring, so that we
can report it once the connection is successful. Now decides whether or not to monitor an FD in socket(), rather than connect(), since we now have to start collecting data before connect() is called. Move code to report on connection state changes into inform*() functions. Warning: Tested, but not exhaustively.
Showing with 271 additions and 103 deletions