qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [3/5] qpid-proton git commit: PROTON-1083: [C++ binding] Now always send *_CLOSE events even after *_ERROR event
Date Mon, 25 Jan 2016 22:10:46 GMT
PROTON-1083: [C++ binding] Now always send *_CLOSE events even after *_ERROR event


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9355e970
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9355e970
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9355e970

Branch: refs/heads/master
Commit: 9355e97093c41b70b147ced2d01e56bea4ee1302
Parents: 4a6ed17
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Mon Jan 25 16:40:42 2016 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Mon Jan 25 16:51:29 2016 -0500

----------------------------------------------------------------------
 proton-c/bindings/cpp/src/messaging_adapter.cpp | 35 ++++++--------------
 1 file changed, 11 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9355e970/proton-c/bindings/cpp/src/messaging_adapter.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/messaging_adapter.cpp b/proton-c/bindings/cpp/src/messaging_adapter.cpp
index 56939e5..fcaf478 100644
--- a/proton-c/bindings/cpp/src/messaging_adapter.cpp
+++ b/proton-c/bindings/cpp/src/messaging_adapter.cpp
@@ -172,48 +172,36 @@ bool is_local_unititialised(pn_state_t state) {
 void messaging_adapter::on_link_remote_close(proton_event &pe) {
     pn_event_t *cevent = pe.pn_event();
     pn_link_t *lnk = pn_event_link(cevent);
-    if (pn_condition_is_set(pn_link_remote_condition(lnk))) {
+    if (peer_close_iserror_ || pn_condition_is_set(pn_link_remote_condition(lnk))) {
         messaging_event mevent(messaging_event::LINK_ERROR, pe);
         delegate_.on_link_error(mevent);
     }
-    else {
-        messaging_event mevent(messaging_event::LINK_CLOSE, pe);
-        delegate_.on_link_close(mevent);
-        if (peer_close_iserror_)
-          delegate_.on_link_error(mevent);
-    }
+    messaging_event mevent(messaging_event::LINK_CLOSE, pe);
+    delegate_.on_link_close(mevent);
     pn_link_close(lnk);
 }
 
 void messaging_adapter::on_session_remote_close(proton_event &pe) {
     pn_event_t *cevent = pe.pn_event();
     pn_session_t *session = pn_event_session(cevent);
-    if (pn_condition_is_set(pn_session_remote_condition(session))) {
+    if (peer_close_iserror_ || pn_condition_is_set(pn_session_remote_condition(session)))
{
         messaging_event mevent(messaging_event::SESSION_ERROR, pe);
         delegate_.on_session_error(mevent);
     }
-    else {
-        messaging_event mevent(messaging_event::SESSION_CLOSE, pe);
-        delegate_.on_session_close(mevent);
-        if (peer_close_iserror_)
-          delegate_.on_session_error(mevent);
-    }
+    messaging_event mevent(messaging_event::SESSION_CLOSE, pe);
+    delegate_.on_session_close(mevent);
     pn_session_close(session);
 }
 
 void messaging_adapter::on_connection_remote_close(proton_event &pe) {
     pn_event_t *cevent = pe.pn_event();
     pn_connection_t *connection = pn_event_connection(cevent);
-    if (pn_condition_is_set(pn_connection_remote_condition(connection))) {
+    if (peer_close_iserror_ || pn_condition_is_set(pn_connection_remote_condition(connection)))
{
         messaging_event mevent(messaging_event::CONNECTION_ERROR, pe);
         delegate_.on_connection_error(mevent);
     }
-    else {
-        messaging_event mevent(messaging_event::CONNECTION_CLOSE, pe);
-        delegate_.on_connection_close(mevent);
-        if (peer_close_iserror_)
-          delegate_.on_connection_error(mevent);
-    }
+    messaging_event mevent(messaging_event::CONNECTION_CLOSE, pe);
+    delegate_.on_connection_close(mevent);
     pn_connection_close(connection);
 }
 
@@ -251,10 +239,9 @@ void messaging_adapter::on_transport_tail_closed(proton_event &pe)
{
         if (pn_condition_is_set(pn_transport_condition(t))) {
             messaging_event mevent(messaging_event::TRANSPORT_ERROR, pe);
             delegate_.on_transport_error(mevent);
-        } else {
-            messaging_event mevent(messaging_event::TRANSPORT_CLOSE, pe);
-            delegate_.on_transport_close(mevent);
         }
+        messaging_event mevent(messaging_event::TRANSPORT_CLOSE, pe);
+        delegate_.on_transport_close(mevent);
     }
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message