Repository: qpid-proton Updated Branches: refs/heads/master cb868e927 -> 000e02ae9
PROTON-1010: Ensure container is always stopped in order to drain all events and release all references Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/000e02ae Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/000e02ae Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/000e02ae Branch: refs/heads/master Commit: 000e02ae93887c86ce4c099327499f1d8d217d47 Parents: cb868e9 Author: Gordon Sim <[email protected]> Authored: Tue Sep 29 12:50:46 2015 +0100 Committer: Gordon Sim <[email protected]> Committed: Tue Sep 29 12:53:19 2015 +0100 ---------------------------------------------------------------------- proton-c/bindings/python/proton/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/000e02ae/proton-c/bindings/python/proton/utils.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/utils.py b/proton-c/bindings/python/proton/utils.py index 8a70299..d3ffeff 100644 --- a/proton-c/bindings/python/proton/utils.py +++ b/proton-c/bindings/python/proton/utils.py @@ -215,6 +215,9 @@ class BlockingConnection(Handler): self.wait(lambda: not (self.conn.state & Endpoint.REMOTE_ACTIVE), msg="Closing connection") + def _is_closed(self): + return self.conn.state & (Endpoint.LOCAL_CLOSED | Endpoint.REMOTE_CLOSED) + def run(self): """ Hand control over to the event loop (e.g. if waiting indefinitely for incoming messages) """ while self.container.process(): pass @@ -239,8 +242,9 @@ class BlockingConnection(Handler): raise Timeout(txt) finally: self.container.timeout = container_timeout - if self.disconnected: + if self.disconnected or self._is_closed(): self.container.stop() + if self.disconnected: raise ConnectionException("Connection %s disconnected" % self.url) def on_link_remote_close(self, event): --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
