You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2015/08/04 18:52:03 UTC

[2/2] qpid-proton git commit: NO-JIRA: add default handling for transport errors

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/8e3231d0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/8e3231d0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/8e3231d0

Branch: refs/heads/0.10.x
Commit: 8e3231d0b4a01e0ec01ed7ef3363b0750dca80b5
Parents: 8fca85a
Author: Gordon Sim <gs...@redhat.com>
Authored: Tue Aug 4 17:30:18 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Tue Aug 4 17:44:11 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/8e3231d0/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