summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-05-14 21:34:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-05-14 21:34:48 +0300
commit18a878f0d3d5429d224fb7db262bfe585d1d8aa0 (patch)
treef320fc03265d4e20bebff920d22d3d1faa21ecb8
parentf890dc4c6e25823a6cec3694a7cefcd88eea1038 (diff)
Jabber: attempt to block access to a socket completely if shutdown procedure is initiated
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp8
1 files changed, 7 insertions, 1 deletions
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);