summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2007-10-19 09:32:56 +0000
committerAndrew Stitcher <astitcher@apache.org>2007-10-19 09:32:56 +0000
commitc386672b7a049f8dc532d940f6e418998faea3c6 (patch)
tree5ec56c1f628bace26537746b1c68d206507d9ebe /cpp
parentbfcdddb9af408b62ae4d2689611be8763df45e0c (diff)
downloadqpid-python-c386672b7a049f8dc532d940f6e418998faea3c6.tar.gz
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
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/sys/posix/AsynchIO.cpp10
1 files changed, 3 insertions, 7 deletions
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;