> I was thinking about an alternate solution, using blocking sockets, > and doing the connect on another thread. If the user cancels the > operation I'd close the socket (BIO_free) and I guess the connect > would return with an error and the thread would exit then. Seems a > little dirty but it could simplify my life. What do you think? > > Cheers, > Gabriel.
I wouldn't recommend that for three reasons. First, you may be on a platform that doesn't support threads or doesn't support threads well. Second, there will always be a race window where the user might close the socket right as you're about to call 'connect'. If that happens, you may wind up 'connect'ing somoene else's socket. Third, it has a complexity and hackishness that increases the risk that odd things will happen. Calling 'getpeername' is a pretty common way to determine if a socket is connected. DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
