Commit a18cbe03 authored by Aurel's avatar Aurel

check master connection is not None before trying to send message


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@171 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0c01a42a
...@@ -84,16 +84,17 @@ class ClientEventHandler(EventHandler): ...@@ -84,16 +84,17 @@ class ClientEventHandler(EventHandler):
if isinstance(node, StorageNode): if isinstance(node, StorageNode):
# Notify primary master node that a storage node is temporarily down # Notify primary master node that a storage node is temporarily down
conn = app.master_conn conn = app.master_conn
conn.lock() if conn is not None:
try: conn.lock()
p = Packet() try:
ip_address, port = node.getServer() p = Packet()
node_list = [(STORAGE_NODE_TYPE, ip_address, port, node.getUUID(), ip_address, port = node.getServer()
TEMPORARILY_DOWN_STATE),] node_list = [(STORAGE_NODE_TYPE, ip_address, port, node.getUUID(),
p.notifyNodeInformation(msg_id, node_list) TEMPORARILY_DOWN_STATE),]
conn.addPacket(p) p.notifyNodeInformation(msg_id, node_list)
finally: conn.addPacket(p)
conn.unlock() finally:
conn.unlock()
# Remove from pool connection # Remove from pool connection
app.cp.removeConnection(node) app.cp.removeConnection(node)
EventHandler.connectionClosed(self, conn) EventHandler.connectionClosed(self, conn)
...@@ -111,16 +112,17 @@ class ClientEventHandler(EventHandler): ...@@ -111,16 +112,17 @@ class ClientEventHandler(EventHandler):
if isinstance(node, StorageNode): if isinstance(node, StorageNode):
# Notify primary master node that a storage node is temporarily down # Notify primary master node that a storage node is temporarily down
conn = app.master_conn conn = app.master_conn
conn.lock() if conn is not None:
try: conn.lock()
p = Packet() try:
ip_address, port = node.getServer() p = Packet()
node_list = [(STORAGE_NODE_TYPE, ip_address, port, node.getUUID(), ip_address, port = node.getServer()
TEMPORARILY_DOWN_STATE),] node_list = [(STORAGE_NODE_TYPE, ip_address, port, node.getUUID(),
p.notifyNodeInformation(msg_id, node_list) TEMPORARILY_DOWN_STATE),]
conn.addPacket(p) p.notifyNodeInformation(msg_id, node_list)
finally: conn.addPacket(p)
conn.unlock() finally:
conn.unlock()
# Remove from pool connection # Remove from pool connection
app.cp.removeConnection(node) app.cp.removeConnection(node)
EventHandler.timeoutExpired(self, conn) EventHandler.timeoutExpired(self, conn)
...@@ -138,16 +140,17 @@ class ClientEventHandler(EventHandler): ...@@ -138,16 +140,17 @@ class ClientEventHandler(EventHandler):
if isinstance(node, StorageNode): if isinstance(node, StorageNode):
# Notify primary master node that a storage node is broken # Notify primary master node that a storage node is broken
conn = app.master_conn conn = app.master_conn
conn.lock() if conn is not None:
try: conn.lock()
p = Packet() try:
ip_address, port = node.getServer() p = Packet()
node_list = [(STORAGE_NODE_TYPE, ip_address, port, node.getUUID(), ip_address, port = node.getServer()
BROKEN_STATE),] node_list = [(STORAGE_NODE_TYPE, ip_address, port, node.getUUID(),
p.notifyNodeInformation(msg_id, node_list) BROKEN_STATE),]
conn.addPacket(p) p.notifyNodeInformation(msg_id, node_list)
finally: conn.addPacket(p)
conn.unlock() finally:
conn.unlock()
# Remove from pool connection # Remove from pool connection
app.cp.removeConnection(node) app.cp.removeConnection(node)
EventHandler.peerBroken(self, conn) EventHandler.peerBroken(self, conn)
......
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