From 753ac739b015ba9abba7b81ed224aaa727379ce2 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 19 Sep 2022 14:20:40 -0400 Subject: [PATCH] Agent: rename find_servers() -. find_available_island_apis() --- monkey/infection_monkey/monkey.py | 4 ++-- monkey/infection_monkey/network/relay/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 33042d2cf..680db9f6f 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -53,7 +53,7 @@ from infection_monkey.network.firewall import app as firewall from infection_monkey.network.info import get_free_tcp_port from infection_monkey.network.relay import TCPRelay from infection_monkey.network.relay.utils import ( - find_server, + find_available_island_apis, notify_disconnect, send_remove_from_waitlist_control_message_to_relays, ) @@ -140,7 +140,7 @@ class InfectionMonkey: # TODO: By the time we finish 2292, _connect_to_island_api() may not need to return `server` def _connect_to_island_api(self) -> Tuple[str, IIslandAPIClient]: logger.debug(f"Trying to wake up with servers: {', '.join(self._opts.servers)}") - server_clients = find_server(self._opts.servers) + server_clients = find_available_island_apis(self._opts.servers) server, island_api_client = self._select_server(server_clients) diff --git a/monkey/infection_monkey/network/relay/utils.py b/monkey/infection_monkey/network/relay/utils.py index e31c9ac97..451fd65e7 100644 --- a/monkey/infection_monkey/network/relay/utils.py +++ b/monkey/infection_monkey/network/relay/utils.py @@ -27,7 +27,7 @@ logger = logging.getLogger(__name__) NUM_FIND_SERVER_WORKERS = 32 -def find_server(servers: Iterable[str]) -> Mapping[str, Optional[IIslandAPIClient]]: +def find_available_island_apis(servers: Iterable[str]) -> Mapping[str, Optional[IIslandAPIClient]]: server_list = list(servers) server_iterator = ThreadSafeIterator(server_list.__iter__()) server_results: Dict[str, Tuple[bool, IIslandAPIClient]] = {}