Commit 80c1cc26 authored by Vincent Pelletier's avatar Vincent Pelletier

Overload handler's dispatch method to always lock connection.

Remove explicit locking from one caller.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@316 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 462ebca0
......@@ -256,11 +256,7 @@ class Application(object):
else:
continue
conn.lock()
try:
conn.handler.dispatch(conn, packet)
finally:
conn.unlock()
if target_conn is conn and msg_id == packet.getId() \
and packet.getType() & 0x8000:
......
......@@ -51,6 +51,16 @@ class ClientEventHandler(EventHandler):
else:
queue.put((conn, packet))
def dispatch(self, conn, packet):
# Before calling superclass's dispatch method, lock the connection.
# This covers the case where handler sends a response to received
# packet.
conn.lock()
try:
super(ClientEventHandler, self).dispatch(conn, packet)
finally:
conn.release()
def _dealWithStorageFailure(self, conn, node, state):
app = self.app
......
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