Commit 0998fa33 authored by Jeremy Hylton's avatar Jeremy Hylton

Call notifyDisconnected() on the object handled by a Connection.

parent e80d0649
......@@ -116,20 +116,19 @@ class ZEOStorage:
self.__storage_id = "uninitialized"
self._transaction = None
def close(self):
def notifyConnected(self, conn):
self._conn = conn
self.client = ClientStub.ClientStorage(conn)
def notifyDisconnected(self):
# When this storage closes, we must ensure that it aborts
# any pending transaction. Not sure if this is the clearest way.
if self._transaction is not None:
self._log("close during transaction %s" % self._transaction,
self._log("disconnected during transaction %s" % self._transaction,
zLOG.BLATHER)
self.tpc_abort(self._transaction.id)
else:
self._log("close", zLOG.BLATHER)
self._conn.close()
def notifyConnected(self, conn):
self._conn = conn
self.client = ClientStub.ClientStorage(conn)
self._log("disconnected", zLOG.BLATHER)
def __repr__(self):
tid = self._transaction and repr(self._transaction.id)
......@@ -392,7 +391,7 @@ class ZEOStorage:
except:
self._log("Unexpected error handling waiting transaction",
level=zLOG.WARNING, error=sys.exc_info())
zeo_storage.close()
zeo_storage._conn.close()
return 0
else:
return 1
......
......@@ -389,9 +389,10 @@ class ManagedServerConnection(ServerConnection):
def __init__(self, sock, addr, obj, mgr):
self.__mgr = mgr
self.__super_init(sock, addr, obj)
obj.notifyConnected(self)
self.obj.notifyConnected(self)
def close(self):
self.obj.notifyDisconnected()
self.__super_close()
self.__mgr.close(self)
......
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