[Zope-Checkins] CVS: Zope/lib/python/ZEO/zrpc - client.py:1.20.2.2 connection.py:1.38.4.2 server.py:1.5.8.2 smac.py:1.35.2.2 trigger.py:1.8.4.2

Chris McDonough chrism@zope.com
Sun, 24 Nov 2002 18:55:28 -0500


Update of /cvs-repository/Zope/lib/python/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv13982/zrpc

Modified Files:
      Tag: chrism-install-branch
	client.py connection.py server.py smac.py trigger.py 
Log Message:
Merge with HEAD.


=== Zope/lib/python/ZEO/zrpc/client.py 1.20.2.1 => 1.20.2.2 ===
--- Zope/lib/python/ZEO/zrpc/client.py:1.20.2.1	Tue Oct  8 20:41:42 2002
+++ Zope/lib/python/ZEO/zrpc/client.py	Sun Nov 24 18:55:26 2002
@@ -172,6 +172,7 @@
                 self.thread = t = ConnectThread(self, self.client,
                                                 self.addrlist,
                                                 self.tmin, self.tmax)
+                t.setDaemon(1)
                 t.start()
             if sync:
                 while self.connection is None:


=== Zope/lib/python/ZEO/zrpc/connection.py 1.38.4.1 => 1.38.4.2 ===
--- Zope/lib/python/ZEO/zrpc/connection.py:1.38.4.1	Tue Oct  8 20:41:42 2002
+++ Zope/lib/python/ZEO/zrpc/connection.py	Sun Nov 24 18:55:26 2002
@@ -348,13 +348,22 @@
         else:
             return 0
 
+    def _pull_trigger(self, tryagain=10):
+        try:
+            self.trigger.pull_trigger()
+        except OSError, e:
+            self.trigger.close()
+            self.trigger = trigger()
+            if tryagain > 0:
+                self._pull_trigger(tryagain=tryagain-1)
+
     def wait(self, msgid):
         """Invoke asyncore mainloop and wait for reply."""
         if __debug__:
             log("wait(%d), async=%d" % (msgid, self.is_async()),
                 level=zLOG.TRACE)
         if self.is_async():
-            self.trigger.pull_trigger()
+            self._pull_trigger()
 
         # Delay used when we call asyncore.poll() directly.
         # Start with a 1 msec delay, double until 1 sec.
@@ -398,7 +407,7 @@
         if __debug__:
             log("poll(), async=%d" % self.is_async(), level=zLOG.TRACE)
         if self.is_async():
-            self.trigger.pull_trigger()
+            self._pull_trigger()
         else:
             asyncore.poll(0.0, self._map)
 


=== Zope/lib/python/ZEO/zrpc/server.py 1.5.8.1 => 1.5.8.2 ===
--- Zope/lib/python/ZEO/zrpc/server.py:1.5.8.1	Tue Oct  8 20:41:42 2002
+++ Zope/lib/python/ZEO/zrpc/server.py	Sun Nov 24 18:55:27 2002
@@ -17,6 +17,7 @@
 
 from ZEO.zrpc.connection import Connection, Delay
 from ZEO.zrpc.log import log
+import zLOG
 
 # Export the main asyncore loop
 loop = asyncore.loop
@@ -42,7 +43,7 @@
         else:
             self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
         self.set_reuse_addr()
-        log("listening on %s" % str(self.addr))
+        log("listening on %s" % str(self.addr), zLOG.INFO)
         self.bind(self.addr)
         self.listen(5)
 


=== Zope/lib/python/ZEO/zrpc/smac.py 1.35.2.1 => 1.35.2.2 ===
--- Zope/lib/python/ZEO/zrpc/smac.py:1.35.2.1	Tue Oct  8 20:41:42 2002
+++ Zope/lib/python/ZEO/zrpc/smac.py	Sun Nov 24 18:55:27 2002
@@ -77,6 +77,9 @@
         self.__closed = 0
         self.__super_init(sock, map)
 
+    def get_addr(self):
+        return self.addr
+
     # XXX avoid expensive getattr calls?  Can't remember exactly what
     # this comment was supposed to mean, but it has something to do
     # with the way asyncore uses getattr and uses if sock:


=== Zope/lib/python/ZEO/zrpc/trigger.py 1.8.4.1 => 1.8.4.2 ===
--- Zope/lib/python/ZEO/zrpc/trigger.py:1.8.4.1	Tue Oct  8 20:41:42 2002
+++ Zope/lib/python/ZEO/zrpc/trigger.py	Sun Nov 24 18:55:27 2002
@@ -11,12 +11,12 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
-import asyncore
 
+import asyncore
 import os
 import socket
-import string
 import thread
+import errno
 
 if os.name == 'posix':
 
@@ -62,7 +62,7 @@
 
         # Override the asyncore close() method, because it seems that
         # it would only close the r file descriptor and not w.  The
-        # constructor calls file_dispactcher.__init__ and passes r,
+        # constructor calls file_dispatcher.__init__ and passes r,
         # which would get stored in a file_wrapper and get closed by
         # the default close.  But that would leave w open...
 
@@ -72,6 +72,7 @@
                 self.del_channel()
                 for fd in self._fds:
                     os.close(fd)
+                self._fds = []
 
         def __repr__(self):
             return '<select-trigger (pipe) at %x>' % id(self)
@@ -85,6 +86,9 @@
         def handle_connect(self):
             pass
 
+        def handle_close(self):
+            self.close()
+
         def pull_trigger(self, thunk=None):
             if thunk:
                 self.lock.acquire()
@@ -95,7 +99,10 @@
             os.write(self.trigger, 'x')
 
         def handle_read(self):
-            self.recv(8192)
+            try:
+                self.recv(8192)
+            except socket.error:
+                return
             self.lock.acquire()
             try:
                 for thunk in self.thunks:
@@ -183,7 +190,10 @@
             self.trigger.send('x')
 
         def handle_read(self):
-            self.recv(8192)
+            try:
+                self.recv(8192)
+            except socket.error:
+                return
             self.lock.acquire()
             try:
                 for thunk in self.thunks: