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

Jeremy Hylton jeremy@zope.com
Thu, 3 Jan 2002 17:29:20 -0500


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

Modified Files:
      Tag: ZEO-ZRPC-Dev
	ClientStorage.py 
Log Message:
Don't assign to self._server until the end of notifyConnected().

No other thread should be able to use self._server until cache
verification is complete.



=== StandaloneZODB/ZEO/ClientStorage.py 1.26.4.23 => 1.26.4.24 ===
     def notifyConnected(self, c):
         log2(INFO, "Connected to storage")
-        self._server = ServerStub.StorageServer(c)
+        stub = ServerStub.StorageServer(c)
 
         self._oids = []
 
-        self._server.register(str(self._storage))
-        self.verify_cache()
+        stub.register(str(self._storage))
+        self.verify_cache(stub)
 
-    def verify_cache(self):
-        self._server.beginZeoVerify()
-        self._cache.verify(self._server.zeoVerify)
-        self._server.endZeoVerify()
+        # Don't make the server available to clients until after
+        # validating the cache
+        self._server = stub
+
+    def verify_cache(self, server):
+        server.beginZeoVerify()
+        self._cache.verify(server.zeoVerify)
+        server.endZeoVerify()
 
     ### Is there a race condition between notifyConnected and
     ### notifyDisconnected? In Particular, what if we get