2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Do not trace out if a packet can't be replied to

This commit is contained in:
Jarrod Johnson 2021-12-20 12:37:18 -05:00
parent abec8c498c
commit 47a83f4628
2 changed files with 16 additions and 4 deletions

View File

@ -112,7 +112,10 @@ def _parse_slp_packet(packet, peer, rsps, xidmap, defer=None, sock=None):
identifier = addr
else:
probepeer = (peer[0], struct.unpack('H', os.urandom(2))[0] | 1025) + peer[2:]
sock.sendto(b'\x00', probepeer)
try:
sock.sendto(b'\x00', probepeer)
except Exception:
return
defer.append((packet, peer))
return
if (identifier, parsed['xid']) in rsps:
@ -487,7 +490,10 @@ def snoop(handler, protocol=None):
mac = neighutil.get_hwaddr(peer[0])
if not mac:
probepeer = (peer[0], struct.unpack('H', os.urandom(2))[0] | 1025) + peer[2:]
s.sendto(b'\x00', probepeer)
try:
s.sendto(b'\x00', probepeer)
except Exception:
continue
deferpeers.append(peer)
continue
process_peer(newmacs, known_peers, peerbymacaddress, peer)

View File

@ -167,7 +167,10 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
continue
mac = neighutil.get_hwaddr(peer[0])
if not mac:
s.sendto(b'\x00', peer)
try:
s.sendto(b'\x00', peer)
except Exception:
continue
deferrednotifies.append((peer, rsp))
continue
_process_snoop(peer, rsp, mac, known_peers, newmacs, peerbymacaddress, byehandler, machandlers)
@ -311,8 +314,11 @@ def _find_service(service, target):
for s in r:
(rsp, peer) = s.recvfrom(9000)
if not neighutil.get_hwaddr(peer[0]):
try:
s.sendto(b'\x00', peer)
except Exception:
continue
deferparse.append((rsp, peer))
s.sendto(b'\x00', peer)
continue
_parse_ssdp(peer, rsp, peerdata)
timeout = deadline - util.monotonic_time()