From 60a7c7ad23d9f616a61f3ab80783198386760a18 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 Feb 2022 18:10:20 +0300 Subject: attempt to fix #2976 --- src/mir_app/src/netlib_ssl.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/netlib_ssl.cpp b/src/mir_app/src/netlib_ssl.cpp index 589f3d7fc7..5db22b75e8 100644 --- a/src/mir_app/src/netlib_ssl.cpp +++ b/src/mir_app/src/netlib_ssl.cpp @@ -336,8 +336,21 @@ MIR_APP_DLL(int) Netlib_SslWrite(HSSL ssl, const char *buf, int num) MIR_APP_DLL(void) Netlib_SslShutdown(HSSL ssl) { - if (ssl && ssl->session) - SSL_shutdown(ssl->session); + if (ssl && ssl->session) { + while (true) { + int ret = SSL_shutdown(ssl->session); + if (ret < 0) { + switch (SSL_get_error(ssl->session, ret)) { + case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_WRITE: + case SSL_ERROR_WANT_ASYNC: + case SSL_ERROR_WANT_ASYNC_JOB: + continue; + } + } + break; + }; + } } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3