From e4e15d87a7bb206b4b215af02b7c8eb0ec888420 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 24 Mar 2022 17:18:05 -0400 Subject: [PATCH] Background redfish check on snoop When snooping, if a redfish device comes along, background the query so that it is unable to block the main SSDP receive routine. --- .../confluent/discovery/protocols/ssdp.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index dcb2881f..684f8c00 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -108,12 +108,15 @@ def _process_snoop(peer, rsp, mac, known_peers, newmacs, peerbymacaddress, byeha if not value.endswith('/DeviceDescription.json'): return if handler: - retdata = check_fish(('/DeviceDescription.json', peerdata)) - if retdata: - known_peers.add(peer) - newmacs.add(mac) - peerbymacaddress[mac] = retdata - machandlers[mac] = handler + eventlet.spawn_n(check_fish_handler, handler, peerdata, known_peers, newmacs, peerbymacaddress, machandlers, mac) + +def check_fish_handler(handler, peerdata, known_peers, newmacs, peerbymacaddress, machandlers, mac): + retdata = check_fish(('/DeviceDescription.json', peerdata)) + if retdata: + known_peers.add(peer) + newmacs.add(mac) + peerbymacaddress[mac] = retdata + machandlers[mac] = handler def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):