Island: Register handle_agent_registration for AGENT_CONNECTED events

This commit is contained in:
Mike Salvatore 2022-09-21 14:56:06 -04:00
parent 271475570d
commit 71da0a559a
1 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,7 @@ from functools import partial
from common import DIContainer
from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic
from monkey_island.cc.island_event_handlers import (
handle_agent_registration,
reset_agent_configuration,
reset_machine_repository,
set_agent_configuration_per_island_mode,
@ -20,11 +21,20 @@ from monkey_island.cc.services.database import Database
def setup_island_event_handlers(container: DIContainer):
island_event_queue = container.resolve(IIslandEventQueue)
_subscribe_agent_registration_events(island_event_queue, container)
_subscribe_reset_agent_configuration_events(island_event_queue, container)
_subscribe_clear_simulation_data_events(island_event_queue, container)
_subscribe_set_island_mode_events(island_event_queue, container)
def _subscribe_agent_registration_events(
island_event_queue: IIslandEventQueue, container: DIContainer
):
topic = IslandEventTopic.AGENT_CONNECTED
island_event_queue.subscribe(topic, container.resolve(handle_agent_registration))
def _subscribe_reset_agent_configuration_events(
island_event_queue: IIslandEventQueue, container: DIContainer
):