From 18a878f0d3d5429d224fb7db262bfe585d1d8aa0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 14 May 2022 21:34:48 +0300 Subject: Jabber: attempt to block access to a socket completely if shutdown procedure is initiated --- protocols/JabberG/src/jabber_thread.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index ec4c10fbfc..908773f418 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1995,13 +1995,16 @@ int ThreadData::recv(char* buf, size_t len) if (this == nullptr) return 0; + if (bShutdown) + return SOCKET_ERROR; + // this select() is still required because shitty openssl is not thread safe if (zRecvReady) { NETLIBSELECT nls = {}; nls.dwTimeout = INFINITE; nls.hReadConns[0] = s; int nSelRes = Netlib_Select(&nls); - if (nSelRes == SOCKET_ERROR || bShutdown) // error + if (nSelRes == SOCKET_ERROR) // error return SOCKET_ERROR; } @@ -2016,6 +2019,9 @@ int ThreadData::send(char* buf, int bufsize) if (this == nullptr) return 0; + if (bShutdown) + return SOCKET_ERROR; + lastWriteTime = ::GetTickCount(); if (bufsize == -1) bufsize = (int)mir_strlen(buf); -- cgit v1.2.3