[Zodb-checkins] CVS: ZEO/ZEO/zrpc - client.py:1.1.2.12
Jeremy Hylton
jeremy@zope.com
Mon, 28 Jan 2002 19:59:51 -0500
Update of /cvs-repository/ZEO/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv18054
Modified Files:
Tag: Standby-branch
client.py
Log Message:
Fix leaking trigger pips caused by test suite. See comment for details.
=== ZEO/ZEO/zrpc/client.py 1.1.2.11 => 1.1.2.12 ===
self.connection.close()
if self.trigger is not None:
+ print repr(self), "close"
self.trigger.close()
def set_async(self, map):
- # XXX need each connection started with async==0 to have a callback
- self.trigger = trigger()
- self.thr_async = 1 # XXX needs to be set on the Connection
+ # This is the callback registered with ThreadedAsync. The
+ # callback might be called multiple times, so it shouldn't
+ # create a trigger every time and should never do anything
+ # after it's closed.
+
+ # It may be that the only case where it is called multiple
+ # times is in the test suite, where ThreadedAsync's loop can
+ # be started in a child process after a fork. Regardless,
+ # it's good to be defensive.
+
+ # XXX need each connection started with async==0 to have a
+ # callback
+ if not self.closed and self.trigger is None:
+ self.trigger = trigger()
+ self.thr_async = 1 # XXX needs to be set on the Connection
def attempt_connect(self):
"""Attempt a connection to the server without blocking too long.
@@ -162,7 +175,6 @@
class ConnectThread(threading.Thread):
"""Thread that tries to connect to server given one or more addresses.
-
The thread is passed a ConnectionManager and the manager's client
as arguments. It calls notifyConnected() on the client when a
socket connects. If notifyConnected() returns without raising an