[Zodb-checkins] CVS: Packages/ZEO - zrpc2.py:1.1.2.3
jeremy@digicool.com
jeremy@digicool.com
Thu, 29 Mar 2001 16:37:34 -0500 (EST)
Update of /cvs-repository/Packages/ZEO
In directory korak:/tmp/cvs-serv20142
Modified Files:
Tag: ZEO-ZRPC-Dev
zrpc2.py
Log Message:
Register ConnectionManager with ThreadedAsync. XXX The async flag
needs to be threaded through to the Connection.
Add some comments about threads.
--- Updated File zrpc2.py in package Packages/ZEO --
--- zrpc2.py 2001/03/29 13:34:32 1.1.2.2
+++ zrpc2.py 2001/03/29 21:37:32 1.1.2.3
@@ -154,6 +154,9 @@
# waiting for a response
self.__reply_lock = thread.allocate_lock()
self.__reply_lock.acquire()
+ # The async mode lock is used to prevent a race between the
+ # write of self.async by set_async() and its use in _do_io()
+ self.__async_mode_lock = thread.allocate_lock()
self.__super_init(sock, addr)
if isinstance(obj, Handler):
self.set_caller = 1
@@ -282,6 +285,9 @@
# The next two methods are used by clients to invoke methods on
# remote objects
+ # XXX these two methods should raise an nice exception if there
+ # are called after the connection is closed
+
def call(self, method, *args):
msgid = self.msgid
self.msgid += 1
@@ -347,18 +353,20 @@
self.connected = 0
self._thread = None
self._callback = None
+ ThreadedAsync.register_loop_callback(self.set_async)
def register_object(self, obj):
self.obj = obj
def set_async(self):
- self.async = 1
+ self.async = 1 # XXX needs to be set on the Connection
self.trigger = trigger.trigger()
def connect(self, sync=0, callback=None):
if self.connected == 1:
return
self._callback = callback
+ # XXX probably need lock around self._thread
if self._thread is None:
self._thread = threading.Thread(target=self.__connect, args=(1,))
self._thread.start()
@@ -409,6 +417,7 @@
def closed(self, conn):
self.connected = 0
+ # perhaps call ClientStorage(XXX) and tell it we closed
self.connect()
class ManagedServerConnection(ServerConnection):