forked from LBRYCommunity/lbry-sdk
log packet encoding errors and warn if the transport is not connected
This commit is contained in:
parent
b4bc5e2110
commit
87c69742cd
1 changed files with 4 additions and 1 deletions
|
@ -214,8 +214,9 @@ class KademliaProtocol(protocol.DatagramProtocol):
|
||||||
try:
|
try:
|
||||||
msgPrimitive = self._encoder.decode(datagram)
|
msgPrimitive = self._encoder.decode(datagram)
|
||||||
message = self._translator.fromPrimitive(msgPrimitive)
|
message = self._translator.fromPrimitive(msgPrimitive)
|
||||||
except (encoding.DecodeError, ValueError):
|
except (encoding.DecodeError, ValueError) as err:
|
||||||
# We received some rubbish here
|
# We received some rubbish here
|
||||||
|
log.exception("Decode error: %s", err)
|
||||||
return
|
return
|
||||||
except (IndexError, KeyError):
|
except (IndexError, KeyError):
|
||||||
log.warning("Couldn't decode dht datagram from %s", address)
|
log.warning("Couldn't decode dht datagram from %s", address)
|
||||||
|
@ -359,6 +360,8 @@ class KademliaProtocol(protocol.DatagramProtocol):
|
||||||
else:
|
else:
|
||||||
log.error("DHT socket error: %s (%i)", err.message, err.errno)
|
log.error("DHT socket error: %s (%i)", err.message, err.errno)
|
||||||
raise err
|
raise err
|
||||||
|
else:
|
||||||
|
log.warning("transport not connected!")
|
||||||
|
|
||||||
def _sendResponse(self, contact, rpcID, response):
|
def _sendResponse(self, contact, rpcID, response):
|
||||||
""" Send a RPC response to the specified contact
|
""" Send a RPC response to the specified contact
|
||||||
|
|
Loading…
Add table
Reference in a new issue