Commit 805274c2 authored by Vincent Pelletier's avatar Vincent Pelletier

Remove a lock on a local variable. Remove associated try/finally block.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@252 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 70f54056
...@@ -71,23 +71,19 @@ class ConnectionPool(object): ...@@ -71,23 +71,19 @@ 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)
conn.lock() if conn.getConnector() is None:
try: # This happens, if a connection could not be established.
if conn.getConnector() is None: logging.error('Connection to storage node %s failed', addr)
# This happens, if a connection could not be established. return None
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