[Zodb-checkins] CVS: StandaloneZODB/ZEO - ClientStorage.py:1.26.4.28

Jeremy Hylton jeremy@zope.com
Mon, 7 Jan 2002 14:28:02 -0500


Update of /cvs-repository/StandaloneZODB/ZEO
In directory cvs.zope.org:/tmp/cvs-serv21838

Modified Files:
      Tag: ZEO-ZRPC-Dev
	ClientStorage.py 
Log Message:
Fix notifyDisconnected() to set _server to None.

_server == None indicates that the client is disconnected.  Without
this assignment, the client will attempt to use a dead connection.

Fix tpc_cond() release logic.  The try/except in tpc_begin() should
not release the lock if _server == None, because notifyDisconnected()
will have already released it.


=== StandaloneZODB/ZEO/ClientStorage.py 1.26.4.27 => 1.26.4.28 ===
     def notifyDisconnected(self, ignored):
         log2(PROBLEM, "Disconnected from storage")
-        self._transaction = None
+        self._server = None
         if self._transaction:
             self._transaction = None
             self.tpc_cond.notifyAll()
@@ -449,7 +449,11 @@
                                        transaction.description,
                                        transaction._extension)
         except:
-            self.tpc_cond.release()
+            # If _server is None, then the client disconnected during
+            # the tpc_begin() and notifyDisconnected() will have
+            # released the lock.
+            if self._server is not None:
+                self.tpc_cond.release()
             raise
 
         self._serial = id