From 3ba7e3b1a306f720792280cdc7734fe8b23e89c4 Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Wed, 12 Jul 2017 12:39:40 -0700 Subject: [PATCH] added broadcasting of node/link messages to multiple session client scenarios --- daemon/core/corehandlers.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/daemon/core/corehandlers.py b/daemon/core/corehandlers.py index ac91c2c2..83ecfbd1 100644 --- a/daemon/core/corehandlers.py +++ b/daemon/core/corehandlers.py @@ -536,12 +536,20 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler): message.queuedtimes = 0 self.queue_message(message) + # delay is required for brief connections, allow session joining if message.message_type == MessageTypes.SESSION.value: - # delay is required for brief connections, allow session joining time.sleep(0.125) - # TODO: do we really want to broadcast node and link messages from a client to other clients? - # self.session.broadcast(self, message) + # broadcast node/link messages to other connected clients + if message.message_type not in [MessageTypes.NODE.value, MessageTypes.LINK.value]: + continue + + for client in self.session.broker.session_clients: + if client == self: + continue + + logger.info("BROADCAST TO OTHER CLIENT: %s", client) + client.sendall(message.raw_message) def handle_node_message(self, message): """