Agent: Add docstrings to RelayConnectionHandler

This commit is contained in:
Kekoa Kaaikala 2022-09-06 19:54:53 +00:00
parent efac1dae98
commit 7ebc403029
1 changed files with 7 additions and 0 deletions

View File

@ -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)