Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Ensure that qpid connection is closed.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Gary Kotton committed May 1, 2013
1 parent 8c964a2 commit 0c9047c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions openstack/common/rpc/impl_qpid.py
Expand Up @@ -331,15 +331,16 @@ def _lookup_consumer(self, receiver):

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

Expand Down

0 comments on commit 0c9047c

Please sign in to comment.