From 86d4a0e473ee2f207f83357e8a3f32b2e20e4e12 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Fri, 1 Mar 2019 18:20:05 +0300 Subject: Fixed TLS connections hanging. After event is delivered from the kernel its further processing is blocked. Non-ready TSL I/O operation should mark connection I/O state as not ready to unblock events and to allow their further processing. Otherwise the connection hangs. --- src/nxt_openssl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/nxt_openssl.c') diff --git a/src/nxt_openssl.c b/src/nxt_openssl.c index 99dd2077..c01f92c8 100644 --- a/src/nxt_openssl.c +++ b/src/nxt_openssl.c @@ -855,12 +855,11 @@ nxt_openssl_conn_test_error(nxt_task_t *task, nxt_conn_t *c, int ret, switch (tls->ssl_error) { case SSL_ERROR_WANT_READ: + c->socket.read_ready = 0; if (io != NXT_OPENSSL_READ) { nxt_fd_event_block_write(task->thread->engine, &c->socket); - c->socket.read_ready = 0; - if (nxt_fd_event_is_disabled(c->socket.read)) { nxt_fd_event_enable_read(task->thread->engine, &c->socket); } @@ -869,12 +868,11 @@ nxt_openssl_conn_test_error(nxt_task_t *task, nxt_conn_t *c, int ret, return NXT_AGAIN; case SSL_ERROR_WANT_WRITE: + c->socket.write_ready = 0; if (io != NXT_OPENSSL_WRITE) { nxt_fd_event_block_read(task->thread->engine, &c->socket); - c->socket.write_ready = 0; - if (nxt_fd_event_is_disabled(c->socket.write)) { nxt_fd_event_enable_write(task->thread->engine, &c->socket); } -- cgit