diff options
| author | Gary Kotton <gkotton@redhat.com> | 2013-05-01 07:52:06 +0000 |
|---|---|---|
| committer | Gary Kotton <gkotton@redhat.com> | 2013-05-01 07:52:06 +0000 |
| commit | 0c9047cc334578f9f4974c3bc006ba9bc62814d2 (patch) | |
| tree | f3b2be98f7b8a47a83f3b792cc7b3fc993590f30 /openstack | |
| parent | 8c964a25a0904f4153eb4fbcfb3cfd4d8a357e0c (diff) | |
| download | oslo-0c9047cc334578f9f4974c3bc006ba9bc62814d2.tar.gz oslo-0c9047cc334578f9f4974c3bc006ba9bc62814d2.tar.xz oslo-0c9047cc334578f9f4974c3bc006ba9bc62814d2.zip | |
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
Diffstat (limited to 'openstack')
| -rw-r--r-- | openstack/common/rpc/impl_qpid.py | 13 |
1 files changed, 7 insertions, 6 deletions
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 |
