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

Drop SLP packets with error

Some implementations send
error for services they do not provide.
This commit is contained in:
Jarrod Johnson 2023-06-08 08:02:59 -04:00
parent 67204f79a1
commit 68f9688292

View File

@ -63,6 +63,9 @@ def _parse_slp_header(packet):
bytes(b'\x00' + packet[7:14]))
parsed['lang'] = packet[14:14 + langlen].decode('utf-8')
parsed['payload'] = packet[14 + langlen:]
errcode = struct.unpack('!H', packet[14 + langlen:16 + langlen])[0]
if errcode != 0:
return None
if offset:
parsed['offset'] = 14 + langlen
parsed['extoffset'] = offset