Commit c83cd1b3 authored by Vincent Pelletier's avatar Vincent Pelletier

Define boolean accessors on Connection subclasses to be able to determine...

Define boolean accessors on Connection subclasses to be able to determine wether a given Connection instance is a listening connection or not.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@345 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 99ad71a9
...@@ -309,6 +309,9 @@ class Connection(BaseConnection): ...@@ -309,6 +309,9 @@ class Connection(BaseConnection):
self.event_dict[msg_id] = event self.event_dict[msg_id] = event
self.em.addIdleEvent(event) self.em.addIdleEvent(event)
def isListeningConnection(self):
raise NotImplementedError
class ClientConnection(Connection): class ClientConnection(Connection):
"""A connection from this node to a remote node.""" """A connection from this node to a remote node."""
def __init__(self, event_manager, handler, addr = None, def __init__(self, event_manager, handler, addr = None,
...@@ -347,9 +350,13 @@ class ClientConnection(Connection): ...@@ -347,9 +350,13 @@ class ClientConnection(Connection):
else: else:
Connection.writable(self) Connection.writable(self)
def isListeningConnection(self):
return False
class ServerConnection(Connection): class ServerConnection(Connection):
"""A connection from a remote node to this node.""" """A connection from a remote node to this node."""
pass def isListeningConnection(self):
return True
class MTClientConnection(ClientConnection): class MTClientConnection(ClientConnection):
"""A Multithread-safe version of ClientConnection.""" """A Multithread-safe version of ClientConnection."""
......
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