Commit b29063a5 authored by Jeremy Hylton's avatar Jeremy Hylton

Add a close() method to the ZEOStorage that closes connection to client.

XXX If select() raises an exception inside asyncore, close the connection.
parent f70d357b
......@@ -118,11 +118,16 @@ class ZEOStorage:
def __init__(self, server):
self.server = server
self.client = None
self._conn = None # the connection associated with client
self.__storage = None
self.__storage_id = "uninitialized"
self._transaction = None
def close(self):
self._conn.close()
def notifyConnected(self, conn):
self._conn = conn
self.client = ClientStub.ClientStorage(conn)
def __repr__(self):
......
......@@ -325,7 +325,12 @@ class Connection(smac.SizedMessageAsyncConnection):
# Do loop only if lock is already acquired. XXX But can't
# we already guarantee that the lock is already acquired?
while not self.__reply_lock.acquire(0):
try:
asyncore.poll(10.0, self._map)
except select.error, err:
log("Closing. asyncore.poll() raised %s." % err,
level=zLOG.BLATHER)
self.close()
if self.closed:
raise DisconnectedError()
self.__reply_lock.release()
......
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