qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject qpid-proton git commit: PROTON-907: check error status of connections selectable, and close transport if set
Date Thu, 02 Jul 2015 15:26:53 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master c1a1df200 -> 5638c5a86


PROTON-907: check error status of connections selectable, and close transport if set


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

Branch: refs/heads/master
Commit: 5638c5a86c4802e587d111ea888d0d3d3a0045b0
Parents: c1a1df2
Author: Gordon Sim <gsim@redhat.com>
Authored: Thu Jul 2 14:02:32 2015 +0100
Committer: Gordon Sim <gsim@redhat.com>
Committed: Thu Jul 2 15:17:39 2015 +0100

----------------------------------------------------------------------
 proton-c/src/messenger/messenger.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5638c5a8/proton-c/src/messenger/messenger.c
----------------------------------------------------------------------
diff --git a/proton-c/src/messenger/messenger.c b/proton-c/src/messenger/messenger.c
index 9749bf5..4507a45 100644
--- a/proton-c/src/messenger/messenger.c
+++ b/proton-c/src/messenger/messenger.c
@@ -233,6 +233,13 @@ void pni_lnr_modified(pn_listener_ctx_t *lnr)
 
 int pn_messenger_process_events(pn_messenger_t *messenger);
 
+static void pni_connection_error(pn_selectable_t *sel)
+{
+  pn_transport_t *transport = pni_transport(sel);
+  pn_transport_close_tail(transport);
+  pn_transport_close_head(transport);
+}
+
 static void pni_connection_readable(pn_selectable_t *sel)
 {
   pn_connection_ctx_t *context = pni_context(sel);
@@ -444,6 +451,7 @@ static pn_connection_ctx_t *pn_connection_ctx(pn_messenger_t *messenger,
   ctx->connection = conn;
   pn_selectable_t *sel = pn_selectable();
   ctx->selectable = sel;
+  pn_selectable_on_error(sel, pni_connection_error);
   pn_selectable_on_readable(sel, pni_connection_readable);
   pn_selectable_on_writable(sel, pni_connection_writable);
   pn_selectable_on_expired(sel, pni_connection_expired);
@@ -1357,6 +1365,9 @@ int pn_messenger_process(pn_messenger_t *messenger)
     if (events & PN_EXPIRED) {
       pn_selectable_expired(sel);
     }
+    if (events & PN_ERROR) {
+      pn_selectable_error(sel);
+    }
   }
   // ensure timer events are processed. Cannot call this inside the while loop
   // as the timer events are not seen by the selector


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


Mime
View raw message