[Zodb-checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.49

Jeremy Hylton jeremy@zope.com
Fri, 16 Aug 2002 18:48:35 -0400


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv3878

Modified Files:
	ClientStorage.py 
Log Message:
Further simplifications of the tpc_cond code in tpc_begin().

Not only can we move the assignment of self._transaction about the
timestamp / id initialization, but we can eliminate the test for
self._server being None.  It will never be None.

self._server is the first instance variable initialized by
__init__().  It is also assigned to in notifyConnected() and
notifyDisconnected(), which do not assign it to None.



=== ZODB3/ZEO/ClientStorage.py 1.48 => 1.49 ===
--- ZODB3/ZEO/ClientStorage.py:1.48	Fri Aug 16 17:58:21 2002
+++ ZODB3/ZEO/ClientStorage.py	Fri Aug 16 18:48:35 2002
@@ -346,15 +346,8 @@
                 self.tpc_cond.release()
                 return
             self.tpc_cond.wait()
-
-        if self._server is None:
-            # XXX Why set _transaction to None?  It must be None now, else
-            # XXX we would have stayed in the while loop.
-            assert self._transaction is None
-            self._transaction = None
-            self.tpc_cond.notify()
-            self.tpc_cond.release()
-            raise ClientDisconnected()
+        self._transaction = transaction
+        self.tpc_cond.release()
 
         if tid is None:
             self._ts = get_timestamp(self._ts)
@@ -362,13 +355,6 @@
         else:
             self._ts = TimeStamp(tid)
             id = tid
-        # XXX Can setting _transaction be moved above the "id=" business?
-        # XXX We want to hold the condvar across as little code as possible,
-        # XXX to slash the chances for deadlock (among other things); e.g.,
-        # XXX if one of those timestamp routines raised an exception, we'd
-        # XXX hold the condvar forever.
-        self._transaction = transaction
-        self.tpc_cond.release()
 
         try:
             r = self._server.tpc_begin(id,