Commit 7ebe221d authored by Vincent Pelletier's avatar Vincent Pelletier

Add a method to get all connections with a given UUID.

This makes clear that it is possible to have more than one connection
to/from a given node. Most obvious case is election, where all masters
try to connect with each other.

Deprecate getConnectionByUUID.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1600 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7096624a
......@@ -111,14 +111,23 @@ class EpollEventManager(object):
return [c for c in self.connection_dict.values() if c.isServer()]
def getConnectionByUUID(self, uuid):
# XXX: deprecated, use getConnectionListByUUID instead.
result = self.getConnectionListByUUID(uuid)
if result is not None:
result = result[:1]
return result
def getConnectionListByUUID(self, uuid):
""" Return the connection associated to the UUID, None if the UUID is
None, invalid or not found"""
if uuid is None:
return None
result = []
append = result.append
for conn in self.connection_dict.values():
if conn.getUUID() == uuid:
return conn
return None
append(conn)
return result
def register(self, conn):
fd = conn.getConnector().getDescriptor()
......
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