Skip to content

Commit

Permalink
Peer disconnect message - add client info (#6947)
Browse files Browse the repository at this point in the history
* add client info to disconnect message

Signed-off-by: Sally MacFarlane <[email protected]>

* exclude disconnect reason message since it makes it harder to analyse

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>
  • Loading branch information
macfarla authored Apr 16, 2024
1 parent 4dd9c65 commit b5b7b9f
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,18 @@ public void handleDisconnect(
final PeerConnection connection,
final DisconnectReason reason,
final boolean initiatedByPeer) {
if (ethPeers.registerDisconnect(connection)) {
LOG.atDebug()
.setMessage("Disconnect - {} - {} - {} - {} peers left")
.addArgument(initiatedByPeer ? "Inbound" : "Outbound")
.addArgument(reason::toString)
.addArgument(() -> connection.getPeer().getLoggableId())
.addArgument(ethPeers::peerCount)
.log();
LOG.atTrace().setMessage("{}").addArgument(ethPeers::toString).log();
}
final boolean wasActiveConnection = ethPeers.registerDisconnect(connection);
LOG.atDebug()
.setMessage("Disconnect - active Connection? {} - {} - {} {} - {} {} - {} peers left")
.addArgument(wasActiveConnection)
.addArgument(initiatedByPeer ? "Inbound" : "Outbound")
.addArgument(reason::getValue)
.addArgument(reason::name)
.addArgument(() -> connection.getPeer().getLoggableId())
.addArgument(() -> connection.getPeerInfo().getClientId())
.addArgument(ethPeers::peerCount)
.log();
LOG.atTrace().setMessage("{}").addArgument(ethPeers::toString).log();
}

private void handleStatusMessage(final EthPeer peer, final Message message) {
Expand Down

0 comments on commit b5b7b9f

Please sign in to comment.