Commit 12636b02 authored by Jeremy Hylton's avatar Jeremy Hylton

XXX Add closed attribute to prevent re-opening the cache after it is closed.

parent 6c971c44
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Network ZODB storage client """Network ZODB storage client
""" """
__version__='$Revision: 1.32 $'[11:-2] __version__='$Revision: 1.33 $'[11:-2]
import struct, time, os, socket, string, Sync, zrpc, ClientCache import struct, time, os, socket, string, Sync, zrpc, ClientCache
import tempfile, Invalidator, ExtensionClass, thread import tempfile, Invalidator, ExtensionClass, thread
...@@ -140,6 +140,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage): ...@@ -140,6 +140,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
name = name or str(connection) name = name or str(connection)
self.closed = 0
self._tfile=tempfile.TemporaryFile() self._tfile=tempfile.TemporaryFile()
self._oids=[] self._oids=[]
self._serials=[] self._serials=[]
...@@ -221,6 +222,9 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage): ...@@ -221,6 +222,9 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
self._call.finishConnect(s) self._call.finishConnect(s)
if self.closed:
return
self._connected=1 self._connected=1
self._oids=[] self._oids=[]
...@@ -298,8 +302,10 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage): ...@@ -298,8 +302,10 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
def close(self): def close(self):
self._lock_acquire() self._lock_acquire()
try: try:
LOG("ClientStorage", INFO, "close")
self._call.closeIntensionally() self._call.closeIntensionally()
self._cache.close() self._cache.close()
self.closed = 1
finally: self._lock_release() finally: self._lock_release()
def commitVersion(self, src, dest, transaction): def commitVersion(self, src, dest, transaction):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment