From ab0a693891aa54aea2e0179b1a70eda43f20bbb1 Mon Sep 17 00:00:00 2001 From: crs Date: Tue, 4 May 2004 19:37:46 +0000 Subject: [PATCH] Fixed bug in TCP socket that caused a busy loop in the socket multiplexer. That caused a lock up on windows when quitting the server with a client connected. --- lib/net/CTCPSocket.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/net/CTCPSocket.cpp b/lib/net/CTCPSocket.cpp index 7c9b12ce..ee276ee0 100644 --- a/lib/net/CTCPSocket.cpp +++ b/lib/net/CTCPSocket.cpp @@ -334,16 +334,22 @@ CTCPSocket::newJob() { // note -- must have m_mutex locked on entry - if (m_socket == NULL || !(m_readable || m_writable)) { + if (m_socket == NULL) { return NULL; } else if (!m_connected) { assert(!m_readable); + if (!(m_readable || m_writable)) { + return NULL; + } return new TSocketMultiplexerMethodJob( this, &CTCPSocket::serviceConnecting, m_socket, m_readable, m_writable); } else { + if (!(m_readable || (m_writable && (m_outputBuffer.getSize() > 0)))) { + return NULL; + } return new TSocketMultiplexerMethodJob( this, &CTCPSocket::serviceConnected, m_socket, m_readable,