Agent: rename find_servers() -. find_available_island_apis()

This commit is contained in:
Mike Salvatore 2022-09-19 14:20:40 -04:00
parent 2ebb7621e3
commit 753ac739b0
2 changed files with 3 additions and 3 deletions

View File

@ -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.info import get_free_tcp_port
from infection_monkey.network.relay import TCPRelay from infection_monkey.network.relay import TCPRelay
from infection_monkey.network.relay.utils import ( from infection_monkey.network.relay.utils import (
find_server, find_available_island_apis,
notify_disconnect, notify_disconnect,
send_remove_from_waitlist_control_message_to_relays, 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` # 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]: def _connect_to_island_api(self) -> Tuple[str, IIslandAPIClient]:
logger.debug(f"Trying to wake up with servers: {', '.join(self._opts.servers)}") 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) server, island_api_client = self._select_server(server_clients)

View File

@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
NUM_FIND_SERVER_WORKERS = 32 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_list = list(servers)
server_iterator = ThreadSafeIterator(server_list.__iter__()) server_iterator = ThreadSafeIterator(server_list.__iter__())
server_results: Dict[str, Tuple[bool, IIslandAPIClient]] = {} server_results: Dict[str, Tuple[bool, IIslandAPIClient]] = {}