diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2009-09-04 11:33:31 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2009-09-04 11:33:31 +0000 |
| commit | 117afca5c4b83a2cdd75847331f200432e4ecf67 (patch) | |
| tree | ff280834de857a5dc556216d841fc3998ed9cecd /qpid/python | |
| parent | a24765fa81f103968460653a247925d63366f2e3 (diff) | |
| download | qpid-python-117afca5c4b83a2cdd75847331f200432e4ecf67.tar.gz | |
fixed the wait logic for session close
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@811350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/driver.py | 1 | ||||
| -rw-r--r-- | qpid/python/qpid/messaging.py | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/qpid/python/qpid/driver.py b/qpid/python/qpid/driver.py index a759588572..fc6481bece 100644 --- a/qpid/python/qpid/driver.py +++ b/qpid/python/qpid/driver.py @@ -191,6 +191,7 @@ class Driver: if ssn.closing: _ssn.close() del self._attachments[ssn] + ssn.closed = True def _exchange_query(self, ssn, address): # XXX: auto sync hack is to avoid deadlock on future diff --git a/qpid/python/qpid/messaging.py b/qpid/python/qpid/messaging.py index 2bf822b4c8..d755aa5054 100644 --- a/qpid/python/qpid/messaging.py +++ b/qpid/python/qpid/messaging.py @@ -286,6 +286,7 @@ class Session: self.closed = False self._lock = connection._lock + self.running = True self.thread = Thread(target = self.run) self.thread.setDaemon(True) self.thread.start() @@ -460,6 +461,7 @@ class Session: @synchronized def run(self): + self.running = True try: while True: msg = self._get(self._pred) @@ -470,7 +472,7 @@ class Session: if self._peek(self._pred) is None: self.connection._waiter.notifyAll() finally: - self.closed = True + self.running = False self.connection._waiter.notifyAll() @synchronized @@ -483,7 +485,7 @@ class Session: self.closing = True self._wakeup() - self._ewait(lambda: self.closed) + self._ewait(lambda: self.closed and not self.running) while self.thread.isAlive(): self.thread.join(3) self.thread = None |
