Ignore Exceptions While Parsing Frames (#1235)

This commit is contained in:
Nick Banks
2017-02-01 05:24:51 -08:00
committed by Jonathan Hui
parent ded722ed7b
commit f2d41102dd
+11 -4
View File
@@ -80,11 +80,18 @@ class Sniffer:
while self._thread_alive.is_set():
data, nodeid = self._transport.recv(self.RECV_BUFFER_SIZE)
msg = self._message_factory.create(io.BytesIO(data))
# Ignore any exceptions
try:
msg = self._message_factory.create(io.BytesIO(data))
if msg is not None:
self.logger.debug("Received message: {}".format(msg))
self._buckets[nodeid].put(msg)
if msg is not None:
self.logger.debug("Received message: {}".format(msg))
self._buckets[nodeid].put(msg)
except Exception as e:
# Just print the exception to the console
print("EXCEPTION: %s" % e)
pass
self.logger.debug("Sniffer stopped.")