According to the boost asio documentation, if I call close on a socket that has an asynchronous connect operation pending, the handler will be called "immediately" with an error code. From the documentation:
This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the boost::asio::error::operation_aborted error.
But the handler is not actually called immediately/synchronously, it is called asynchronously when control returns to the io_service. Is it possible that my connect handler still gets called without an error code after I call close, if the connect actually succeeded and my handler callback has already been posted to the io_service?