Commit 8c5179ff authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use isListeningConnection() instead of isinstance.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@347 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bba28c85
...@@ -65,7 +65,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -65,7 +65,7 @@ class BootstrapEventHandler(StorageEventHandler):
StorageEventHandler.connectionAccepted(self, conn, s, addr) StorageEventHandler.connectionAccepted(self, conn, s, addr)
def timeoutExpired(self, conn): def timeoutExpired(self, conn):
if isinstance(conn, ClientConnection): if not conn.islisteningConnection():
app = self.app app = self.app
if app.trying_master_node is app.primary_master_node: if app.trying_master_node is app.primary_master_node:
# If a primary master node timeouts, I should not rely on it. # If a primary master node timeouts, I should not rely on it.
...@@ -76,7 +76,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -76,7 +76,7 @@ class BootstrapEventHandler(StorageEventHandler):
StorageEventHandler.timeoutExpired(self, conn) StorageEventHandler.timeoutExpired(self, conn)
def connectionClosed(self, conn): def connectionClosed(self, conn):
if isinstance(conn, ClientConnection): if not conn.islisteningConnection():
app = self.app app = self.app
if app.trying_master_node is app.primary_master_node: if app.trying_master_node is app.primary_master_node:
# If a primary master node closes, I should not rely on it. # If a primary master node closes, I should not rely on it.
...@@ -87,7 +87,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -87,7 +87,7 @@ class BootstrapEventHandler(StorageEventHandler):
StorageEventHandler.connectionClosed(self, conn) StorageEventHandler.connectionClosed(self, conn)
def peerBroken(self, conn): def peerBroken(self, conn):
if isinstance(conn, ClientConnection): if not conn.islisteningConnection():
app = self.app app = self.app
if app.trying_master_node is app.primary_master_node: if app.trying_master_node is app.primary_master_node:
# If a primary master node gets broken, I should not rely # If a primary master node gets broken, I should not rely
...@@ -99,7 +99,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -99,7 +99,7 @@ class BootstrapEventHandler(StorageEventHandler):
StorageEventHandler.peerBroken(self, conn) StorageEventHandler.peerBroken(self, conn)
def handleNotReady(self, conn, packet, message): def handleNotReady(self, conn, packet, message):
if isinstance(conn, ClientConnection): if not conn.islisteningConnection():
app = self.app app = self.app
if app.trying_master_node is not None: if app.trying_master_node is not None:
app.trying_master_node = None app.trying_master_node = None
...@@ -108,7 +108,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -108,7 +108,7 @@ class BootstrapEventHandler(StorageEventHandler):
def handleRequestNodeIdentification(self, conn, packet, node_type, def handleRequestNodeIdentification(self, conn, packet, node_type,
uuid, ip_address, port, name): uuid, ip_address, port, name):
if isinstance(conn, ClientConnection): if not conn.isListeningConnection():
self.handleUnexpectedPacket(conn, packet) self.handleUnexpectedPacket(conn, packet)
else: else:
app = self.app app = self.app
...@@ -155,7 +155,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -155,7 +155,7 @@ class BootstrapEventHandler(StorageEventHandler):
def handleAcceptNodeIdentification(self, conn, packet, node_type, def handleAcceptNodeIdentification(self, conn, packet, node_type,
uuid, ip_address, port, uuid, ip_address, port,
num_partitions, num_replicas): num_partitions, num_replicas):
if not isinstance(conn, ClientConnection): if conn.isListeningConnection():
self.handleUnexpectedPacket(conn, packet) self.handleUnexpectedPacket(conn, packet)
else: else:
app = self.app app = self.app
...@@ -197,7 +197,7 @@ class BootstrapEventHandler(StorageEventHandler): ...@@ -197,7 +197,7 @@ class BootstrapEventHandler(StorageEventHandler):
def handleAnswerPrimaryMaster(self, conn, packet, primary_uuid, def handleAnswerPrimaryMaster(self, conn, packet, primary_uuid,
known_master_list): known_master_list):
if not isinstance(conn, ClientConnection): if conn.isListeningConnection():
self.handleUnexpectedPacket(conn, packet) self.handleUnexpectedPacket(conn, packet)
else: else:
app = self.app 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