--- a/src/ssl_client.c Thu May 07 02:49:49 2009 +0300
+++ b/src/ssl_client.c Thu May 07 02:57:11 2009 +0300
@@ -210,16 +210,17 @@
RESET_ERROR(&err);
// perform the next handshake step
+ // this returns zero when the handshake is not yet done, errors/completion then trigger the else-if-else below
if (ssl_client_handshake(client, &err) == 0) {
// handshake continues
- // XXX: this state flag is completely wrong
- } else if (SSL_CLIENT_TRANSPORT(client)->connected) {
- // the async connect process has now completed, either succesfully or with an error
+ } else if (!SSL_CLIENT_TRANSPORT(client)->connected) {
+ // the async connect+handshake process has completed
// invoke the user connect callback directly with appropriate error
transport_connected(SSL_CLIENT_TRANSPORT(client), ERROR_CODE(&err) ? &err : NULL, true);
} else {
+ // in-connection re-handshake completed
if (ERROR_CODE(&err))
// the re-handshake failed, so this transport is dead
transport_error(SSL_CLIENT_TRANSPORT(client), &err);