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

Jeremy Hylton jeremy@zope.com
Mon, 28 Jan 2002 16:56:50 -0500


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

Modified Files:
      Tag: Standby-branch
	ClientStorage.py 
Log Message:
Make sure _tbuf is closed.

Also add suffix to tbuf temp file, so you can see who to blame if it
isn't closed.


=== ZEO/ZEO/ClientStorage.py 1.35.6.6 => 1.35.6.7 ===
 
     def close(self):
-        self._rpc_mgr.close()
+        if self._tbuf is not None:
+            self._tbuf.close()
         if self._cache is not None:
             self._cache.close()
+        self._rpc_mgr.close()
 
     def registerDB(self, db, limit):
         """Register that the storage is controlled by the given DB."""
@@ -529,7 +531,7 @@
         self._info.update(dict)
 
     def begin(self):
-        self._tfile = tempfile.TemporaryFile()
+        self._tfile = tempfile.TemporaryFile(suffix=".inv")
         self._pickler = cPickle.Pickler(self._tfile, 1)
         self._pickler.fast = 1 # Don't use the memo
 
@@ -545,6 +547,7 @@
         self._pickler.dump((0,0))
         self._tfile.seek(0)
         unpick = cPickle.Unpickler(self._tfile)
+        f = self._tfile
         self._tfile = None
 
         while 1:
@@ -553,6 +556,7 @@
                 break
             self._cache.invalidate(oid, version=version)
             self._db.invalidate(oid, version=version)
+        f.close()
 
     def Invalidate(self, args):
         for oid, version in args: