summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-02-23 18:10:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-02-23 18:10:20 +0300
commit60a7c7ad23d9f616a61f3ab80783198386760a18 (patch)
treebefe1e18222decb629ec00994a6161bbf859cdc5 /src/mir_app
parenta0998d7237e4b3950c80178e59d0ea81e2c23917 (diff)
attempt to fix #2976
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/netlib_ssl.cpp17
1 files changed, 15 insertions, 2 deletions
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;
+ };
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////