[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - connection.py:1.38.2.5.4.1
Jeremy Hylton
jeremy at zope.com
Thu Jun 12 15:58:35 EDT 2003
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv12547/ZEO/zrpc
Modified Files:
Tag: jeremy-more-mysteries-branch
connection.py
Log Message:
Revise deferred_wait() and deferred_call() for real use.
Remove the leading underscore since they're now public.
=== ZODB3/ZEO/zrpc/connection.py 1.38.2.5 => 1.38.2.5.4.1 ===
--- ZODB3/ZEO/zrpc/connection.py:1.38.2.5 Thu Jun 5 18:42:36 2003
+++ ZODB3/ZEO/zrpc/connection.py Thu Jun 12 14:58:33 2003
@@ -331,20 +331,24 @@
else:
return r_args
- # For testing purposes, it is useful to begin a synchronous call
- # but not block waiting for its response. Since these methods are
- # used for testing they can assume they are not in async mode and
- # call asyncore.poll() directly to get the message out without
- # also waiting for the reply.
+ # In some cases, it is necessary to send the call with a lock
+ # held, but it isn't safe to hold the lock until the call returns.
+ # The next two methods allow the call to be sent without waiting
+ # for the response.
- def _deferred_call(self, method, *args):
+ def deferred_call(self, method, release, *args):
if self.closed:
raise DisconnectedError()
msgid = self.send_call(method, args, 0)
- asyncore.poll(0.01, self._map)
+ if release:
+ release()
+ if self.is_async():
+ self._pull_trigger()
+ else:
+ asyncore.poll(0.01, self._map)
return msgid
- def _deferred_wait(self, msgid):
+ def deferred_wait(self, msgid):
r_flags, r_args = self.wait(msgid)
if (isinstance(r_args, types.TupleType)
and type(r_args[0]) == types.ClassType
More information about the Zodb-checkins
mailing list