You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2017/03/01 16:32:02 UTC
qpid-proton git commit: PROTON-1423: Python reconnect on
amqp:connection:forced
Repository: qpid-proton
Updated Branches:
refs/heads/master 7241e775f -> 11fe67e30
PROTON-1423: Python reconnect on amqp:connection:forced
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/11fe67e3
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/11fe67e3
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/11fe67e3
Branch: refs/heads/master
Commit: 11fe67e3033c1f3b672882199c020f28d82c9c72
Parents: 7241e77
Author: Clifford Jansen <cl...@apache.org>
Authored: Wed Mar 1 08:27:10 2017 -0800
Committer: Clifford Jansen <cl...@apache.org>
Committed: Wed Mar 1 08:29:41 2017 -0800
----------------------------------------------------------------------
proton-c/bindings/python/proton/handlers.py | 4 ++++
proton-c/bindings/python/proton/reactor.py | 11 ++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/11fe67e3/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 a689e65..6d580b7 100644
--- a/proton-c/bindings/python/proton/handlers.py
+++ b/proton-c/bindings/python/proton/handlers.py
@@ -255,6 +255,10 @@ class EndpointStateHandler(Handler):
def on_connection_remote_close(self, event):
if event.connection.remote_condition:
+ if event.connection.remote_condition.name == "amqp:connection:forced":
+ # Treat this the same as just having the transport closed by the peer without
+ # sending any events. Allow reconnection to happen transparently.
+ return
self.on_connection_error(event)
elif self.is_local_closed(event.connection):
self.on_connection_closed(event)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/11fe67e3/proton-c/bindings/python/proton/reactor.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/reactor.py b/proton-c/bindings/python/proton/reactor.py
index 269ed9e..04c5037 100644
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@ -576,26 +576,27 @@ class Connector(Handler):
self.on_transport_closed(event)
def on_transport_closed(self, event):
- if self.connection and self.connection.state & Endpoint.LOCAL_ACTIVE:
+ if self.connection is None: return
+ if self.connection.state & Endpoint.LOCAL_ACTIVE:
if self.reconnect:
event.transport.unbind()
delay = self.reconnect.next()
if delay == 0:
logging.info("Disconnected, reconnecting...")
self._connect(self.connection, event.reactor)
+ return
else:
logging.info("Disconnected will try to reconnect after %s seconds" % delay)
event.reactor.schedule(delay, self)
+ return
else:
logging.debug("Disconnected")
- self.connection = None
+ # See connector.cpp: conn.free()/pn_connection_release() here?
+ self.connection = None
def on_timer_task(self, event):
self._connect(self.connection, event.reactor)
- def on_connection_remote_close(self, event):
- self.connection = None
-
class Backoff(object):
"""
A reconnect strategy involving an increasing delay between
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org