From c386672b7a049f8dc532d940f6e418998faea3c6 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Fri, 19 Oct 2007 09:32:56 +0000 Subject: Fix for leak on receiving eof on network git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@586345 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/posix/AsynchIO.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/posix/AsynchIO.cpp b/cpp/src/qpid/sys/posix/AsynchIO.cpp index c8babaf421..b2c50facd7 100644 --- a/cpp/src/qpid/sys/posix/AsynchIO.cpp +++ b/cpp/src/qpid/sys/posix/AsynchIO.cpp @@ -189,11 +189,7 @@ void AsynchIO::readable(DispatchHandle& h) { errno = 0; int readCount = buff->byteCount-buff->dataCount; int rc = h.getSocket().read(buff->bytes + buff->dataCount, readCount); - if (rc == 0) { - eofCallback(*this); - h.unwatchRead(); - return; - } else if (rc > 0) { + if (rc > 0) { buff->dataCount += rc; readCallback(*this, buff); if (rc != readCount) { @@ -204,8 +200,8 @@ void AsynchIO::readable(DispatchHandle& h) { // Put buffer back bufferQueue.push_back(buff); - // This is effectively the same as eof - if (errno == ECONNRESET) { + // Eof or other side has gone away + if (rc == 0 || errno == ECONNRESET) { eofCallback(*this); h.unwatchRead(); return; -- cgit v1.2.1