You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2010/06/01 20:54:56 UTC

svn commit: r950201 - in /qpid/trunk/qpid/cpp/src/qpid/sys: AsynchIOHandler.cpp posix/AsynchIO.cpp

Author: gsim
Date: Tue Jun  1 18:54:56 2010
New Revision: 950201

URL: http://svn.apache.org/viewvc?rev=950201&view=rev
Log:
QPID-2636: Ensure close is called for a disconnect preventing occasional leaks of abruptly terminated connections

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOHandler.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOHandler.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOHandler.cpp?rev=950201&r1=950200&r2=950201&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOHandler.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/AsynchIOHandler.cpp Tue Jun  1 18:54:56 2010
@@ -173,9 +173,8 @@ void AsynchIOHandler::readbuff(AsynchIO&
     }
 }
 
-void AsynchIOHandler::eof(AsynchIO&) {
-    QPID_LOG(debug, "DISCONNECTED [" << identifier << "]");
-    if (codec) codec->closed();
+void AsynchIOHandler::eof(AsynchIO& a) {
+    disconnect(a);
     readError = true;
     aio->queueWriteClose();
 }
@@ -190,9 +189,9 @@ void AsynchIOHandler::closedSocket(Async
     delete this;
 }
 
-void AsynchIOHandler::disconnect(AsynchIO& a) {
-    // treat the same as eof
-    eof(a);
+void AsynchIOHandler::disconnect(AsynchIO&) {
+    QPID_LOG(debug, "DISCONNECTED [" << identifier << "]");
+    if (codec) codec->closed();
 }
 
 // Notifications

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp?rev=950201&r1=950200&r2=950201&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/posix/AsynchIO.cpp Tue Jun  1 18:54:56 2010
@@ -554,13 +554,9 @@ void AsynchIO::writeable(DispatchHandle&
 }
         
 void AsynchIO::disconnected(DispatchHandle& h) {
-    // If we've already queued close do it instead of disconnected callback
-    if (queuedClose) {
-        close(h);
-    } else if (disCallback) {
-        disCallback(*this);
-        h.unwatch();
-    }
+    // If we have not already queued close then call disconnected callback before closing
+    if (!queuedClose && disCallback) disCallback(*this);
+    close(h);
 }
 
 /*



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org