[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - trigger.py:1.12 smac.py:1.36 connection.py:1.39
Jeremy Hylton
jeremy@zope.com
Mon, 18 Nov 2002 18:18:11 -0500
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv21897/ZEO/zrpc
Modified Files:
trigger.py smac.py connection.py
Log Message:
Merge ZODB 3.1 changes to the trunk.
XXX Not sure if berkeley still works.
=== ZODB3/ZEO/zrpc/trigger.py 1.11 => 1.12 ===
--- ZODB3/ZEO/zrpc/trigger.py:1.11 Tue Nov 12 08:36:11 2002
+++ ZODB3/ZEO/zrpc/trigger.py Mon Nov 18 18:17:40 2002
@@ -16,6 +16,7 @@
import os
import socket
import thread
+import errno
if os.name == 'posix':
@@ -71,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)
@@ -83,6 +85,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.35 => 1.36 ===
--- ZODB3/ZEO/zrpc/smac.py:1.35 Mon Oct 7 17:16:53 2002
+++ ZODB3/ZEO/zrpc/smac.py Mon Nov 18 18:17:40 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.39 ===
--- ZODB3/ZEO/zrpc/connection.py:1.38 Sat Sep 28 23:24:17 2002
+++ ZODB3/ZEO/zrpc/connection.py Mon Nov 18 18:17:40 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)