summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
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
commit4a121dfc2d6b40c145aa53cf5eb60f7dc711d276 (patch)
tree477dd12c4889692a7817b236e46a93730d3d0d9d /qpid/cpp/src
parent953d326196f316c99aeb6a3cd01c3e3313fd6a92 (diff)
downloadqpid-python-4a121dfc2d6b40c145aa53cf5eb60f7dc711d276.tar.gz
Fix for leak on receiving eof on network
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@586345 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp b/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
index c8babaf421..b2c50facd7 100644
--- a/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
+++ b/qpid/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;