catch id validation errors

This commit is contained in:
Jack Robison 2017-10-24 20:12:05 -04:00
parent edb8928f5c
commit 628c46e5d9
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -205,14 +205,14 @@ class KademliaProtocol(protocol.DatagramProtocol):
return
try:
msgPrimitive = self._encoder.decode(datagram)
except encoding.DecodeError:
message = self._translator.fromPrimitive(msgPrimitive)
except (encoding.DecodeError, ValueError):
# We received some rubbish here
return
except IndexError:
log.warning("Couldn't decode dht datagram from %s", address)
return
message = self._translator.fromPrimitive(msgPrimitive)
remoteContact = Contact(message.nodeID, address[0], address[1], self)
now = time.time()