You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2007/10/19 11:32:57 UTC
svn commit: r586345 -
/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
Author: astitcher
Date: Fri Oct 19 02:32:56 2007
New Revision: 586345
URL: http://svn.apache.org/viewvc?rev=586345&view=rev
Log:
Fix for leak on receiving eof on network
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp?rev=586345&r1=586344&r2=586345&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp Fri Oct 19 02:32:56 2007
@@ -189,11 +189,7 @@
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 @@
// 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;