Author: gsim
Date: Thu Nov 13 06:48:44 2008
New Revision: 713739

URL: http://svn.apache.org/viewvc?rev=713739&view=rev
Log:
Don't stop connector until close has been sent and close-ok received in 
response. (If necessary delay error notification until then).


Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.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=713739&r1=713738&r2=713739&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionHandler.cpp Thu Nov 
13 06:48:44 2008
@@ -93,8 +93,9 @@
     }catch(std::exception& e){
         QPID_LOG(warning, "Closing connection due to " << e.what());        
         setState(CLOSING);
+        errorCode = CLOSE_CODE_FRAMING_ERROR;
+        errorText = e.what();
         proxy.close(501, e.what());    
-        if (onError) onError(501, e.what());
     }
 }
 
@@ -203,7 +204,9 @@
 void ConnectionHandler::closeOk()
 {
     checkState(CLOSING, INVALID_STATE_CLOSE_OK);
-    if (onClose) {
+    if (onError && errorCode != CLOSE_CODE_NORMAL) {
+        onError(errorCode, errorText);
+    } else if (onClose) {
         onClose();
     }
     setState(CLOSED);


Reply via email to