common: ssl_tls_write / read return 0 on socket close

This commit is contained in:
Jay Sorg 2017-05-09 13:06:40 -07:00 committed by jsorg71
parent 1f27a4d850
commit 75fd3fcf89
1 changed files with 8 additions and 0 deletions

View File

@ -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;