2 Commits

View File

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