From 3bcdf139a797cc735f3073d2a75564282a0afc2e Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 8 Feb 2004 16:51:45 +0000 Subject: [PATCH] No longer sending incorrect disconnect events in read() and removed redundant sending of disconnect event in close(). --- lib/net/CTCPSocket.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/net/CTCPSocket.cpp b/lib/net/CTCPSocket.cpp index cdfed02e..fd592203 100644 --- a/lib/net/CTCPSocket.cpp +++ b/lib/net/CTCPSocket.cpp @@ -129,8 +129,9 @@ CTCPSocket::read(void* buffer, UInt32 n) m_inputBuffer.pop(n); // if no more data and we cannot read or write then send disconnected - if (n > 0 && !m_readable && !m_writable) { + if (n > 0 && m_inputBuffer.getSize() == 0 && !m_readable && !m_writable) { sendSocketEvent(getDisconnectedEvent()); + m_connected = false; } return n; @@ -459,6 +460,7 @@ CTCPSocket::serviceConnected(ISocketMultiplexerJob* job, sendStreamEvent(getOutputShutdownEvent()); if (!m_readable && m_inputBuffer.getSize() == 0) { sendSocketEvent(getDisconnectedEvent()); + m_connected = false; } needNewJob = true; } @@ -502,6 +504,7 @@ CTCPSocket::serviceConnected(ISocketMultiplexerJob* job, sendStreamEvent(getInputShutdownEvent()); if (!m_writable && m_inputBuffer.getSize() == 0) { sendSocketEvent(getDisconnectedEvent()); + m_connected = false; } m_readable = false; needNewJob = true;