fix a client counting bug by deferring client instantiation

This commit is contained in:
Jakob Ketterl 2022-01-03 15:19:12 +01:00
parent 60f57bf206
commit 2ce7d943fa
1 changed files with 4 additions and 4 deletions

View File

@ -492,17 +492,17 @@ class HandshakeMessageHandler(Handler):
client = None
if "type" in handshake:
if handshake["type"] == "receiver":
client = OpenWebRxReceiverClient(conn)
client = OpenWebRxReceiverClient
elif handshake["type"] == "map":
client = MapConnection(conn)
client = MapConnection
else:
logger.warning("invalid connection type: %s", handshake["type"])
if client is not None:
logger.debug("handshake complete, handing off to %s", type(client).__name__)
logger.debug("handshake complete, handing off to %s", client.__name__)
# hand off all further communication to the correspondig connection
conn.send("CLIENT DE SERVER server=openwebrx version={version}".format(version=openwebrx_version))
conn.setMessageHandler(client)
conn.setMessageHandler(client(conn))
else:
logger.warning('invalid handshake received')
else: