2 Commits

View File

@@ -53,6 +53,7 @@ class BackendServer:
self.message_handlers: dict[
tuple[Category, ActionType], Callable[[Client, Message], None]
] = {}
self._initialize_handlers()
self.running: bool = False
@@ -274,7 +275,7 @@ class BackendServer:
f"First message from {client} must be HELLO, disconnecting..."
)
self._disconnect(client)
return
continue
handler: Callable[[Client, Message], None] | None = (
self.message_handlers.get(
@@ -283,6 +284,11 @@ class BackendServer:
)
if handler is not None:
handler(client, msg)
else:
self.logger.warning(
f"No handler for message {msg.id} with category {msg.category} and action {msg.action}"
)
continue
if msg.ack_required:
self.send_ack(client, target_id=msg.id)