[Zodb-checkins] SVN: ZODB/branches/3.3/src/ZEO/zrpc/connection.py Forward port from ZODB 3.2.

Tim Peters tim.one at comcast.net
Wed Feb 9 16:42:30 EST 2005


Log message for revision 29092:
  Forward port from ZODB 3.2.
  
  Connection.__init__():  Python 2.4 added a new gimmick to asyncore (a
  ._map attribute on asyncore.dispatcher instances) that breaks the
  delicate ZEO startup dance.  Repaired that.
  

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

-=-
Modified: ZODB/branches/3.3/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/3.3/src/ZEO/zrpc/connection.py	2005-02-09 18:32:15 UTC (rev 29091)
+++ ZODB/branches/3.3/src/ZEO/zrpc/connection.py	2005-02-09 21:42:30 UTC (rev 29092)
@@ -265,6 +265,17 @@
         # Now it's safe to register with asyncore's socket map; it was not
         # safe before message_input was replaced, or before handshake() was
         # invoked.
+        # Obscure:  in Python 2.4, the base asyncore.dispatcher class grew
+        # a ._map attribute, which is used instead of asyncore's global
+        # socket map when ._map isn't None.  Because we passed `ourmap` to
+        # the base class constructor above, in 2.4 asyncore believes we want
+        # to use `ourmap` instead of the global socket map -- but we don't.
+        # So we have to replace our ._map with the global socket map, and
+        # update the global socket map with `ourmap`.  Replacing our ._map
+        # isn't necessary before Python 2.4, but doesn't hurt then (it just
+        # gives us an unused attribute in 2.3); updating the global socket
+        # map is necessary regardless of Python version.
+        self._map = asyncore.socket_map
         asyncore.socket_map.update(ourmap)
 
     def __repr__(self):



More information about the Zodb-checkins mailing list