2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-16 18:49:04 +00:00

Fix ssdp snoop of XCC

SSDP was declaring victory too early, wait until
the right volume of information is confirmed available
before commiting to shared structures.
This commit is contained in:
Jarrod Johnson 2022-01-07 09:00:44 -05:00
parent d18d7592d3
commit e54277f8f8

View File

@ -79,16 +79,13 @@ def scan(services, target=None):
def _process_snoop(peer, rsp, mac, known_peers, newmacs, peerbymacaddress, byehandler, machandlers, handler):
known_peers.add(peer)
newmacs.add(mac)
if mac in peerbymacaddress and peer not in peerbymacaddress[mac]['addresses']:
peerbymacaddress[mac]['addresses'].append(peer)
else:
peerbymacaddress[mac] = {
peerdata = {
'hwaddr': mac,
'addresses': [peer],
}
peerdata = peerbymacaddress[mac]
for headline in rsp[1:]:
if not headline:
continue
@ -113,6 +110,9 @@ def _process_snoop(peer, rsp, mac, known_peers, newmacs, peerbymacaddress, byeha
if handler:
retdata = check_fish(('/DeviceDescription.json', peerdata))
if retdata:
known_peers.add(peer)
newmacs.add(mac)
peerbymacaddress[mac] = peerdata
handler(retdata)