fix: server logs an error on extra registration payload fields

Addresses #1 by logging registration with extra fields. It would be possible to ignore
extra fields, but for now it's better to silently fail to prevent spam registrations.
This commit is contained in:
agatha 2024-09-07 15:50:38 -04:00
parent d7151ca5b0
commit 829e842d09

View File

@ -70,6 +70,9 @@ class Server:
if not agent_id: if not agent_id:
agent_id = self.register_agent(agent_info) agent_id = self.register_agent(agent_info)
if not agent_id:
logger.error(f"Failed to register agent from {addr}")
return
logger.info(f"Agent {agent_id} registered from {addr}") logger.info(f"Agent {agent_id} registered from {addr}")
self.commands[agent_id] = f"set_id {agent_id}" self.commands[agent_id] = f"set_id {agent_id}"
else: else: