in zktraffic/base/sniffer.py [0:0]
def handle_packet(self, packet):
sampling = self.config.sampling
if sampling < 1.0 and random() > sampling:
return
try:
message = self.message_from_packet(packet)
self.handle_message(message)
except (BadPacket, StringTooLong, DeserializationError, struct.error) as ex:
if self.config.dump_bad_packet:
print("got: %s" % str(ex))
hexdump.hexdump(packet.load)
sys.stdout.flush()