qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r603411 - in /incubator/qpid/trunk/qpid/cpp/src/qpid/client: ConnectionHandler.cpp ConnectionImpl.cpp
Date Tue, 11 Dec 2007 23:20:36 GMT
Author: aconway
Date: Tue Dec 11 15:20:34 2007
New Revision: 603411

URL: http://svn.apache.org/viewvc?rev=603411&view=rev
Log:
Fixed client crash on error opening a connection.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp?rev=603411&r1=603410&r2=603411&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp Tue Dec 11 15:20:34
2007
@@ -102,12 +102,18 @@
 
 void ConnectionHandler::close()
 {
-    if (getState() != OPEN) {
-        throw Exception("Connection not open");
+    switch (getState()) {
+      case NEGOTIATING:
+      case OPENING:
+        setState(FAILED);
+        break;
+      case OPEN:
+        setState(CLOSING);
+        send(ConnectionCloseBody(version, 200, OK, 0, 0));
+        waitFor(CLOSED);
+        break;
+        // Nothing to do for CLOSING, CLOSED, FAILED or NOT_STARTED
     }
-    setState(CLOSING);
-    send(ConnectionCloseBody(version, 200, OK, 0, 0));
-    waitFor(CLOSED);
 }
 
 void ConnectionHandler::send(const framing::AMQBody& body)

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp?rev=603411&r1=603410&r2=603411&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp Tue Dec 11 15:20:34 2007
@@ -88,6 +88,7 @@
 
 void ConnectionImpl::close()
 {
+    Mutex::ScopedLock l(lock);
     if (!isClosed)
         handler.close();
 }



Mime
View raw message