Commit 18226f49 authored by Vincent Pelletier's avatar Vincent Pelletier

Revert commit 252: connection is sent to dispatcher via registration, so it's safer to lock it.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@290 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d04c53f2
...@@ -72,19 +72,23 @@ class ConnectionPool(object): ...@@ -72,19 +72,23 @@ class ConnectionPool(object):
app.local_var.node_not_ready = 0 app.local_var.node_not_ready = 0
conn = MTClientConnection(app.em, handler, addr, conn = MTClientConnection(app.em, handler, addr,
connector_handler=self.app.connector_handler) connector_handler=self.app.connector_handler)
if conn.getConnector() is None: conn.lock()
# This happens, if a connection could not be established. try:
logging.error('Connection to storage node %s failed', addr) if conn.getConnector() is None:
return None # This happens, if a connection could not be established.
logging.error('Connection to storage node %s failed', addr)
return None
msg_id = conn.getNextId() msg_id = conn.getNextId()
p = Packet() p = Packet()
p.requestNodeIdentification(msg_id, CLIENT_NODE_TYPE, p.requestNodeIdentification(msg_id, CLIENT_NODE_TYPE,
app.uuid, addr[0], app.uuid, addr[0],
addr[1], app.name) addr[1], app.name)
conn.addPacket(p) conn.addPacket(p)
conn.expectMessage(msg_id) conn.expectMessage(msg_id)
app.dispatcher.register(conn, msg_id, app.getQueue()) app.dispatcher.register(conn, msg_id, app.getQueue())
finally:
conn.unlock()
try: try:
app._waitMessage(conn, msg_id) app._waitMessage(conn, msg_id)
......
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