From 7ebc403029ae31a19f8425cdaf95ab48ddd584c6 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Tue, 6 Sep 2022 19:54:53 +0000 Subject: [PATCH] Agent: Add docstrings to RelayConnectionHandler --- .../network/relay/relay_connection_handler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monkey/infection_monkey/network/relay/relay_connection_handler.py b/monkey/infection_monkey/network/relay/relay_connection_handler.py index 156b78ddd..3d7755fb9 100644 --- a/monkey/infection_monkey/network/relay/relay_connection_handler.py +++ b/monkey/infection_monkey/network/relay/relay_connection_handler.py @@ -8,11 +8,18 @@ RELAY_CONTROL_MESSAGE = b"infection-monkey-relay-control-message: -" class RelayConnectionHandler: + """Handles new relay connections.""" + def __init__(self, pipe_spawner: TCPPipeSpawner, relay_user_handler: RelayUserHandler): self._pipe_spawner = pipe_spawner self._relay_user_handler = relay_user_handler def handle_new_connection(self, sock: socket.socket): + """ + Spawn a new pipe, or remove the user if the user requested to disconnect. + + :param sock: The socket for the new connection. + """ addr, _ = sock.getpeername() addr = IPv4Address(addr)