From 75fd3fcf89df169d25ce7867b82fb0a13eb72644 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 9 May 2017 13:06:40 -0700 Subject: [PATCH] common: ssl_tls_write / read return 0 on socket close --- common/ssl_calls.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/ssl_calls.c b/common/ssl_calls.c index f92cc972..72e2184e 100644 --- a/common/ssl_calls.c +++ b/common/ssl_calls.c @@ -743,6 +743,10 @@ ssl_tls_read(struct ssl_tls *tls, char *data, int length) g_sck_can_send(tls->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT); continue; + /* socket closed */ + case SSL_ERROR_ZERO_RETURN: + return 0; + default: ssl_tls_print_error("SSL_read", tls->ssl, status); status = -1; @@ -792,6 +796,10 @@ ssl_tls_write(struct ssl_tls *tls, const char *data, int length) g_sck_can_send(tls->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT); continue; + /* socket closed */ + case SSL_ERROR_ZERO_RETURN: + return 0; + default: ssl_tls_print_error("SSL_write", tls->ssl, status); status = -1;