[Zodb-checkins] CVS: Packages/ZEO/zrpc - client.py:1.25.16.6
connection.py:1.49.4.3
Tim Peters
tim.one at comcast.net
Mon Oct 18 14:00:23 EDT 2004
Update of /cvs-repository/Packages/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv32735/lib/python/ZEO/zrpc
Modified Files:
Tag: Zope-2_7-branch
client.py connection.py
Log Message:
Collector 1541: Python 2.4/Zope 2.7.3: unittests fail In LoopCallback.py
Repair select.select() errors in the two testNOK tests.
Backport rev 3172 from ZODB 3.3. Here's Jeremy's checkin comment; note
that the same failures would occur under Python 2.3.5 (if that's ever
released):
"""
Fix bug that prevented ZEO from working with Python 2.4.
Connection initialized _map as a dict containing a single entry
mapping the connection's fileno to the connection. That was a misuse
of the _map variable, which is also used by the asyncore.dispatcher
base class to indicate whether the dispatcher users the default
socket_map or a custom socket_map. A recent change to asyncore caused
it to use _map in its add_channel() and del_channel() methods, which
presumes to be a bug fix (may get ported to 2.3). That causes our
dubious use of _map to be a problem, because we also put the
Connections in the global socket_map. The new asyncore won't remove
it from the global socket map, because it has a custom _map.
"""
=== Packages/ZEO/zrpc/client.py 1.25.16.5 => 1.25.16.6 ===
--- Packages/ZEO/zrpc/client.py:1.25.16.5 Thu Oct 23 20:24:05 2003
+++ Packages/ZEO/zrpc/client.py Mon Oct 18 14:00:23 2004
@@ -85,6 +85,7 @@
def close(self):
"""Prevent ConnectionManager from opening new connections"""
self.closed = 1
+ ThreadedAsync.remove_loop_callback(self.set_async)
self.cond.acquire()
try:
t = self.thread
=== Packages/ZEO/zrpc/connection.py 1.49.4.2 => 1.49.4.3 ===
--- Packages/ZEO/zrpc/connection.py:1.49.4.2 Tue Sep 30 14:49:38 2003
+++ Packages/ZEO/zrpc/connection.py Mon Oct 18 14:00:23 2004
@@ -156,7 +156,10 @@
self.thr_async = 0
self.trigger = None
self._prepare_async()
- self._map = {self._fileno: self}
+ # The singleton dict is used in synchronous mode when a method
+ # needs to call into asyncore to try to force some I/O to occur.
+ # The singleton dict is a socket map containing only this object.
+ self._singleton = {self._fileno: self}
# msgid_lock guards access to msgid
self.msgid_lock = threading.Lock()
# replies_cond is used to block when a synchronous call is
@@ -182,7 +185,7 @@
def close(self):
if self.closed:
return
- self._map.clear()
+ self._singleton.clear()
self.closed = 1
self.close_trigger()
self.__super_close()
@@ -383,7 +386,7 @@
if self.closed:
raise DisconnectedError()
msgid = self.send_call(method, args, 0)
- asyncore.poll(0.01, self._map)
+ asyncore.poll(0.01, self._singleton)
return msgid
def _deferred_wait(self, msgid):
@@ -471,7 +474,7 @@
if __debug__:
self.log("wait(%d): asyncore.poll(%s)" %
(msgid, delay), level=zLOG.TRACE)
- asyncore.poll(delay, self._map)
+ asyncore.poll(delay, self._singleton)
if delay < 1.0:
delay += delay
except select.error, err:
@@ -497,7 +500,7 @@
if self.is_async():
self._pull_trigger()
else:
- asyncore.poll(0.0, self._map)
+ asyncore.poll(0.0, self._singleton)
def pending(self, timeout=0):
"""Invoke mainloop until any pending messages are handled."""
More information about the Zodb-checkins
mailing list