From a7549632225de5cde73c77d663711a1b3f98e6e1 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Thu, 1 Sep 2022 13:32:07 +0200 Subject: [PATCH] Agent: Remove on_user_disconnected in TCPRelay --- monkey/infection_monkey/tcp_relay.py | 4 ---- .../tests/unit_tests/infection_monkey/test_tcp_relay.py | 9 --------- 2 files changed, 13 deletions(-) diff --git a/monkey/infection_monkey/tcp_relay.py b/monkey/infection_monkey/tcp_relay.py index 4d8cebe29..812c4e6e3 100644 --- a/monkey/infection_monkey/tcp_relay.py +++ b/monkey/infection_monkey/tcp_relay.py @@ -72,10 +72,6 @@ class TCPRelay(Thread): self._relay_users[user_address] = RelayUser(user_address, time()) - def on_user_disconnected(self, user_address: IPv4Address): - """Handle user disconnection.""" - pass - def relay_users(self) -> Dict[IPv4Address, RelayUser]: """ Get the list of users connected to the relay. diff --git a/monkey/tests/unit_tests/infection_monkey/test_tcp_relay.py b/monkey/tests/unit_tests/infection_monkey/test_tcp_relay.py index 70c1c6bbb..17d5c84b2 100644 --- a/monkey/tests/unit_tests/infection_monkey/test_tcp_relay.py +++ b/monkey/tests/unit_tests/infection_monkey/test_tcp_relay.py @@ -42,15 +42,6 @@ def test_user_added(tcp_relay): assert NEW_USER_ADDRESS in users -def test_user_not_removed_on_disconnect(tcp_relay): - # A user should only be disconnected when they send a disconnect request - tcp_relay.on_user_connected(NEW_USER_ADDRESS) - tcp_relay.on_user_disconnected(NEW_USER_ADDRESS) - - users = tcp_relay.relay_users() - assert len(users) == 1 - - def test_user_removed_on_request(tcp_relay): tcp_relay.on_user_connected(NEW_USER_ADDRESS) tcp_relay.on_user_data_received(RELAY_CONTROL_MESSAGE, NEW_USER_ADDRESS)