From 0c9047cc334578f9f4974c3bc006ba9bc62814d2 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Wed, 1 May 2013 07:52:06 +0000 Subject: Ensure that qpid connection is closed. Fixes bug 1172922 When reestablishing a session and a connection already exists the existing connection will be closed prior to opening the new one. Change-Id: I9a25800fe4b56eba89d550e3461ce095bf902f0a --- openstack/common/rpc/impl_qpid.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'openstack') diff --git a/openstack/common/rpc/impl_qpid.py b/openstack/common/rpc/impl_qpid.py index 8e1e450..a7b4707 100644 --- a/openstack/common/rpc/impl_qpid.py +++ b/openstack/common/rpc/impl_qpid.py @@ -331,15 +331,16 @@ class Connection(object): def reconnect(self): """Handles reconnecting and re-establishing sessions and queues""" - if self.connection.opened(): - try: - self.connection.close() - except qpid_exceptions.ConnectionError: - pass - attempt = 0 delay = 1 while True: + # Close the session if necessary + if self.connection.opened(): + try: + self.connection.close() + except qpid_exceptions.ConnectionError: + pass + broker = self.brokers[attempt % len(self.brokers)] attempt += 1 -- cgit