Commit 6cc02efa authored by Guido van Rossum's avatar Guido van Rossum

Remove the code from call() (and wait()) that serialized outgoing

calls.  If multiple threads sharing a ZEO connection want to make
overlapping calls, they can do that now.  This is mostly useful when
one thread is waiting for a long-running pack() or undo*() call -- the
other thread can now proceed.

Jeremy & I did a review of the StorageServer code and found no place
where overlapping incoming calls from the same connection could do any
harm -- given that the only places where incoming calls can be handled
are those places where the server makes a callback to the client.
parent fcab00e3
...@@ -306,18 +306,9 @@ class Connection(smac.SizedMessageAsyncConnection): ...@@ -306,18 +306,9 @@ class Connection(smac.SizedMessageAsyncConnection):
return msgid return msgid
def call(self, method, *args): def call(self, method, *args):
self.__replies_cond.acquire() if self.closed:
try: raise DisconnectedError()
while self.__replies and not self.closed: msgid = self.send_call(method, args, 0)
log("waiting for previous call to finish %s" %
repr(self.__replies.values()[0]))
self.__replies_cond.wait(30)
if self.closed:
raise DisconnectedError()
msgid = self.send_call(method, args, 0)
self.__replies[msgid] = None
finally:
self.__replies_cond.release()
r_flags, r_args = self.wait(msgid) r_flags, r_args = self.wait(msgid)
if (isinstance(r_args, types.TupleType) if (isinstance(r_args, types.TupleType)
and type(r_args[0]) == types.ClassType and type(r_args[0]) == types.ClassType
...@@ -367,8 +358,6 @@ class Connection(smac.SizedMessageAsyncConnection): ...@@ -367,8 +358,6 @@ class Connection(smac.SizedMessageAsyncConnection):
reply = self.__replies.get(msgid) reply = self.__replies.get(msgid)
if reply is not None: if reply is not None:
del self.__replies[msgid] del self.__replies[msgid]
assert len(self.__replies) == 0
self.__replies_cond.notifyAll()
return reply return reply
if self.is_async(): if self.is_async():
self.__replies_cond.wait(10.0) self.__replies_cond.wait(10.0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment