summaryrefslogtreecommitdiff
path: root/python/qpid/messaging
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-03-23 20:34:58 +0000
committerRafael H. Schloming <rhs@apache.org>2010-03-23 20:34:58 +0000
commit7cfa62f6187ddecfdf7149cc501778b66d8cfcc8 (patch)
tree182e61f704191fb5471b6a1cd316bda5c426b2e1 /python/qpid/messaging
parent858769adbb30ff616f39f20c9ecc1a0bd3349205 (diff)
downloadqpid-python-7cfa62f6187ddecfdf7149cc501778b66d8cfcc8.tar.gz
fixed resource leakage on repeated connection open/close
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@926766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/messaging')
-rw-r--r--python/qpid/messaging/driver.py3
-rw-r--r--python/qpid/messaging/endpoints.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/python/qpid/messaging/driver.py b/python/qpid/messaging/driver.py
index ba53d94e33..01393d6d70 100644
--- a/python/qpid/messaging/driver.py
+++ b/python/qpid/messaging/driver.py
@@ -342,6 +342,9 @@ class Driver:
def start(self):
self._selector.register(self)
+ def stop(self):
+ self._selector.unregister(self)
+
def fileno(self):
return self._socket.fileno()
diff --git a/python/qpid/messaging/endpoints.py b/python/qpid/messaging/endpoints.py
index af2b1a8007..195c6e7ef7 100644
--- a/python/qpid/messaging/endpoints.py
+++ b/python/qpid/messaging/endpoints.py
@@ -102,7 +102,6 @@ class Connection:
self.error = None
from driver import Driver
self._driver = Driver(self)
- self._driver.start()
def _wait(self, predicate, timeout=None):
return self._waiter.wait(predicate, timeout=timeout)
@@ -157,6 +156,7 @@ class Connection:
Connect to the remote endpoint.
"""
self._connected = True
+ self._driver.start()
self._wakeup()
self._ewait(lambda: self._transport_connected and not self._unlinked(),
exc=ConnectError)
@@ -175,6 +175,8 @@ class Connection:
self._connected = False
self._wakeup()
self._ewait(lambda: not self._transport_connected)
+ self._driver.stop()
+ self._condition.gc()
@synchronized
def connected(self):