Skip to content

Commit

Permalink
add handling for MalformedMessage during peer connection (#1242)
Browse files Browse the repository at this point in the history
* add handling for MalformedMessage during peer connection

* Dump full stack traces in debug logs
  • Loading branch information
pipermerriam authored Sep 3, 2018
1 parent c4e602f commit fd5c5d4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion p2p/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,15 @@ async def connect(self, remote: Node) -> BasePeer:
except BadAckMessage:
# This is kept separate from the `expected_exceptions` to be sure that we aren't
# silencing an error in our authentication code.
self.logger.info('Got bad auth ack from %r', remote)
self.logger.error('Got bad auth ack from %r', remote)
# dump the full stacktrace in the debug logs
self.logger.debug('Got bad auth ack from %r', remote, exc_info=True)
except MalformedMessage:
# This is kept separate from the `expected_exceptions` to be sure that we aren't
# silencing an error in how we decode messages during handshake.
self.logger.error('Got malformed response from %r during handshake', remote)
# dump the full stacktrace in the debug logs
self.logger.debug('Got malformed response from %r', remote, exc_info=True)
except expected_exceptions as e:
self.logger.debug("Could not complete handshake with %r: %s", remote, repr(e))
except Exception:
Expand Down

0 comments on commit fd5c5d4

Please sign in to comment.