diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index e1d1fc122..9e535138e 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -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()