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: NO-JIRA: add default handling for transport errors
Date Tue, 04 Aug 2015 16:32:18 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 7c9e5673f -> 864b47e09


NO-JIRA: add default handling for transport errors


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

Branch: refs/heads/master
Commit: 864b47e098fd6b21a11a50e78447b2532373e1aa
Parents: 7c9e567
Author: Gordon Sim <gsim@redhat.com>
Authored: Tue Aug 4 17:30:18 2015 +0100
Committer: Gordon Sim <gsim@redhat.com>
Committed: Tue Aug 4 17:30:18 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/proton/handlers.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/864b47e0/proton-c/bindings/python/proton/handlers.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/handlers.py b/proton-c/bindings/python/proton/handlers.py
index 4288cf8..f4ad5a9 100644
--- a/proton-c/bindings/python/proton/handlers.py
+++ b/proton-c/bindings/python/proton/handlers.py
@@ -387,6 +387,23 @@ class MessagingHandler(Handler, Acking):
         self.handlers.append(EndpointStateHandler(peer_close_is_error, self))
         self.handlers.append(IncomingMessageHandler(auto_accept, self))
         self.handlers.append(OutgoingMessageHandler(auto_settle, self))
+        self.fatal_conditions = ["amqp:unauthorized-access"]
+
+    def on_transport_error(self, event):
+        """
+        Called when some error is encountered with the transport over
+        which the AMQP connection is to be established. This includes
+        authentication errors as well as socket errors.
+        """
+        if event.transport.condition:
+            if event.transport.condition.info:
+                logging.error("%s: %s" % (event.transport.condition.name, event.transport.condition.description,
event.transport.condition.info))
+            else:
+                logging.error("%s: %s" % (event.transport.condition.name, event.transport.condition.description))
+            if event.transport.condition.name in self.fatal_conditions:
+                event.connection.close()
+        else:
+            logging.error("Unspecified transport error")
 
     def on_connection_error(self, event):
         """


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


Mime
View raw message