summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-05-12 18:16:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-05-12 18:16:19 +0300
commitf890dc4c6e25823a6cec3694a7cefcd88eea1038 (patch)
tree7b0048e7749f1b9295e1a3fcc80628e5b1136243
parent9afbec637cfb9ebc5096ff84692e85ca6bf0844c (diff)
oops... select() doesnt'return -1 if a socket gets closed... wtf...
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp3
-rw-r--r--protocols/JabberG/src/stdafx.h3
2 files changed, 5 insertions, 1 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index cfe2742631..ec4c10fbfc 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1987,6 +1987,7 @@ void ThreadData::shutdown(void)
{
if (s)
Netlib_Shutdown(s);
+ bShutdown = true;
}
int ThreadData::recv(char* buf, size_t len)
@@ -2000,7 +2001,7 @@ int ThreadData::recv(char* buf, size_t len)
nls.dwTimeout = INFINITE;
nls.hReadConns[0] = s;
int nSelRes = Netlib_Select(&nls);
- if (nSelRes == SOCKET_ERROR) // error
+ if (nSelRes == SOCKET_ERROR || bShutdown) // error
return SOCKET_ERROR;
}
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index cf41737088..61218888f5 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -386,6 +386,9 @@ struct ThreadData
int send(char* buffer, int bufsize = -1);
int send(TiXmlElement *node);
int send_no_strm_mgmt(TiXmlElement *node);
+
+private:
+ bool bShutdown;
};
struct JABBER_MODEMSGS