From 7cfa62f6187ddecfdf7149cc501778b66d8cfcc8 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Tue, 23 Mar 2010 20:34:58 +0000 Subject: 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 --- python/qpid/messaging/driver.py | 3 +++ python/qpid/messaging/endpoints.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'python/qpid/messaging') 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): -- cgit v1.2.1