[Zodb-checkins] CVS: Packages/ZEO - zrpc2.py:1.1.2.13

jeremy@digicool.com jeremy@digicool.com
Mon, 7 May 2001 09:11:58 -0400 (EDT)


Update of /cvs-repository/Packages/ZEO
In directory korak:/tmp/cvs-serv20945

Modified Files:
      Tag: ZEO-ZRPC-Dev
	zrpc2.py 
Log Message:
Connection is no longer its own socket map; manage explicit dict.

Add useful defaults for tmin and tmax to Connection.



--- Updated File zrpc2.py in package Packages/ZEO --
--- zrpc2.py	2001/05/01 22:35:03	1.1.2.12
+++ zrpc2.py	2001/05/07 13:11:56	1.1.2.13
@@ -144,6 +144,7 @@
         # The reply lock is used to block when a synchronous call is
         # waiting for a response
         self.__super_init(sock, addr)
+        self._map = {self._fileno: self}
         self._prepare_async()
         self.__call_lock = thread.allocate_lock()
         self.__reply_lock = thread.allocate_lock()
@@ -260,27 +261,6 @@
         self.message_output(msg)
         self._do_io()
 
-    # The next five methods implement an asyncore socket map
-
-    def keys(self):
-        return (self._fileno,)
-    
-    def values(self):
-        return (self,)
-    
-    def items(self):
-        return ((self._fileno, self),)
-    
-    def __len__(self):
-        return 1
-    
-    def __getitem__(self, key):
-        if key == self._fileno:
-            return self
-        raise KeyError, key
-        
-    # The previous five methods implement an asyncore socket map
-
     # The next two methods are used by clients to invoke methods on
     # remote objects  
 
@@ -371,10 +351,10 @@
             if wait:
                 # do loop only if lock is already acquired
                 while not self.__reply_lock.acquire(0):
-                    asyncore.poll(60.0, self)
+                    asyncore.poll(60.0, self._map)
                 self.__reply_lock.release()
             else:
-                asyncore.poll(0.0, self)
+                asyncore.poll(0.0, self._map)
 
         # XXX it seems that we need to release before returning if
         # called with wait==1.  perhaps the caller need not acquire
@@ -392,7 +372,7 @@
     # XXX requires that obj implement notifyConnected and
     # notifyDisconnected.   make this optional?
 
-    def __init__(self, addr, obj=None, debug=1, tmin=None, tmax=None):
+    def __init__(self, addr, obj=None, debug=1, tmin=1, tmax=180):
         self.addr = addr
         self.obj = obj
         self.tmin = tmin