Skip to content

Commit

Permalink
Log more info when peer is lost during request
Browse files Browse the repository at this point in the history
  • Loading branch information
carver committed Sep 26, 2018
1 parent 76d43ea commit f562759
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions trinity/protocol/common/managers.py
Expand Up @@ -176,13 +176,17 @@ async def _cleanup(self) -> None:
if self.pending_request is not None:
self.logger.debug("Stream %r shutting down, cancelling the pending request", self)
_, future = self.pending_request
future.set_exception(PeerConnectionLost("Pending request can't complete: peer is gone"))
future.set_exception(PeerConnectionLost(
f"Pending request can't complete: {self} is shutting down"
))

def deregister_peer(self, peer: BasePeer) -> None:
if self.pending_request is not None:
self.logger.debug("Peer stream %r shutting down, cancelling the pending request", self)
_, future = self.pending_request
future.set_exception(PeerConnectionLost("Pending request can't complete: peer is gone"))
future.set_exception(PeerConnectionLost(
f"Pending request can't complete: {self} peer went offline"
))

def __repr__(self) -> str:
return f'<ResponseCandidateStream({self._peer!s}, {self.response_msg_type!r})>'
Expand Down

0 comments on commit f562759

Please sign in to comment.