[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - trigger.py:1.8.2.2 smac.py:1.34.2.2 connection.py:1.38.2.1

Jeremy Hylton jeremy@zope.com
Tue, 12 Nov 2002 15:18:10 -0500


Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv20159/ZEO/zrpc

Modified Files:
      Tag: ZODB3-3_1-branch
	trigger.py smac.py connection.py 
Log Message:
Merge the deadlock debug code to the release branch.


=== ZODB3/ZEO/zrpc/trigger.py 1.8.2.1 => 1.8.2.2 ===
--- ZODB3/ZEO/zrpc/trigger.py:1.8.2.1	Tue Nov 12 08:35:58 2002
+++ ZODB3/ZEO/zrpc/trigger.py	Tue Nov 12 15:18:09 2002
@@ -17,6 +17,7 @@
 import socket
 import string
 import thread
+import errno
 
 if os.name == 'posix':
 
@@ -72,6 +73,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)
@@ -84,6 +86,9 @@
 
         def handle_connect(self):
             pass
+
+        def handle_close(self):
+            self.close()
 
         def pull_trigger(self, thunk=None):
             if thunk:


=== ZODB3/ZEO/zrpc/smac.py 1.34.2.1 => 1.34.2.2 ===
--- ZODB3/ZEO/zrpc/smac.py:1.34.2.1	Wed Oct 16 17:44:06 2002
+++ ZODB3/ZEO/zrpc/smac.py	Tue Nov 12 15:18:09 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:


=== ZODB3/ZEO/zrpc/connection.py 1.38 => 1.38.2.1 ===
--- ZODB3/ZEO/zrpc/connection.py:1.38	Sat Sep 28 23:24:17 2002
+++ ZODB3/ZEO/zrpc/connection.py	Tue Nov 12 15:18:09 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)