[Zodb-checkins] SVN: ZODB/branches/jim-zrpc/src/ZEO/zrpc/connection.py Server now writes to socket most of the time -- doesn't just queue.

Jim Fulton jim at zope.com
Wed Jan 27 14:22:09 EST 2010


Log message for revision 108579:
  Server now writes to socket most of the time -- doesn't just queue.
  

Changed:
  U   ZODB/branches/jim-zrpc/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/branches/jim-zrpc/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/jim-zrpc/src/ZEO/zrpc/connection.py	2010-01-27 18:59:12 UTC (rev 108578)
+++ ZODB/branches/jim-zrpc/src/ZEO/zrpc/connection.py	2010-01-27 19:22:09 UTC (rev 108579)
@@ -583,7 +583,6 @@
                 self.return_error(msgid, *error)
             return
 
-
         if async:
             if ret is not None:
                 raise ZRPCError("async method %s returned value %s" %
@@ -595,7 +594,7 @@
             if isinstance(ret, Delay):
                 ret.set_sender(msgid, self)
             else:
-                self.send_reply(msgid, ret)
+                self.send_reply(msgid, ret, not self.delay_sesskey)
 
         if self.delay_sesskey:
             self.__super_setSessionKey(self.delay_sesskey)
@@ -720,7 +719,7 @@
         self.obj.notifyDisconnected()
         Connection.close(self)
 
-    def send_reply(self, msgid, ret):
+    def send_reply(self, msgid, ret, immediately=True):
         # encode() can pass on a wide variety of exceptions from cPickle.
         # While a bare `except` is generally poor practice, in this case
         # it's acceptable -- we really do want to catch every exception
@@ -735,8 +734,11 @@
             err = ZRPCError("Couldn't pickle return %.100s" % r)
             msg = self.marshal.encode(msgid, 0, REPLY, (ZRPCError, err))
         self.message_output(msg)
-        self.poll()
+        if immediately:
+            self.poll()
 
+    poll = smac.SizedMessageAsyncConnection.handle_write
+
 class ManagedClientConnection(Connection):
     """Client-side Connection subclass."""
     __super_init = Connection.__init__



More information about the Zodb-checkins mailing list