Commit 69bd5f7a authored by Sergey Lyubka's avatar Sergey Lyubka

SSL_accept logic fix

parent 41b3c1b2
...@@ -656,10 +656,10 @@ static void ns_read_from_socket(struct ns_connection *conn) { ...@@ -656,10 +656,10 @@ static void ns_read_from_socket(struct ns_connection *conn) {
if (ret == 0 && ok == 0 && conn->ssl != NULL) { if (ret == 0 && ok == 0 && conn->ssl != NULL) {
int res = SSL_connect(conn->ssl); int res = SSL_connect(conn->ssl);
int ssl_err = SSL_get_error(conn->ssl, res); int ssl_err = SSL_get_error(conn->ssl, res);
DBG(("%p res %d %d", conn, res, ssl_err)); DBG(("%p SSL_connect %d %d", conn, res, ssl_err));
if (res == 1) { if (res == 1) {
conn->flags = NSF_SSL_HANDSHAKE_DONE; conn->flags = NSF_SSL_HANDSHAKE_DONE;
} else if (res == 0 && (ssl_err == 2 || ssl_err == 3)) { } else if (ssl_err == 2 || ssl_err == 3) {
return; // Call us again return; // Call us again
} else { } else {
ok = 1; ok = 1;
...@@ -682,10 +682,10 @@ static void ns_read_from_socket(struct ns_connection *conn) { ...@@ -682,10 +682,10 @@ static void ns_read_from_socket(struct ns_connection *conn) {
} else { } else {
int res = SSL_accept(conn->ssl); int res = SSL_accept(conn->ssl);
int ssl_err = SSL_get_error(conn->ssl, res); int ssl_err = SSL_get_error(conn->ssl, res);
DBG(("%p res %d %d", conn, res, ssl_err)); DBG(("%p SSL_accept %d %d", conn, res, ssl_err));
if (res == 1) { if (res == 1) {
conn->flags |= NSF_SSL_HANDSHAKE_DONE; conn->flags |= NSF_SSL_HANDSHAKE_DONE;
} else if (res == 0 && (ssl_err == 2 || ssl_err == 3)) { } else if (ssl_err == 2 || ssl_err == 3) {
return; // Call us again return; // Call us again
} else { } else {
conn->flags |= NSF_CLOSE_IMMEDIATELY; conn->flags |= NSF_CLOSE_IMMEDIATELY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment