From 2ce7d943fabf76268c80b2470cc3ec68db764e3b Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 3 Jan 2022 15:19:12 +0100 Subject: [PATCH] fix a client counting bug by deferring client instantiation --- owrx/connection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/owrx/connection.py b/owrx/connection.py index b012f51..c0b7861 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -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: