Peer disconnect message - add client info (#6947)

* add client info to disconnect message

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

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

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/6964/head
Sally MacFarlane 7 months ago committed by GitHub
parent 4dd9c65ff7
commit b5b7b9f5f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 22
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java

@ -425,16 +425,18 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
final PeerConnection connection, final PeerConnection connection,
final DisconnectReason reason, final DisconnectReason reason,
final boolean initiatedByPeer) { final boolean initiatedByPeer) {
if (ethPeers.registerDisconnect(connection)) { final boolean wasActiveConnection = ethPeers.registerDisconnect(connection);
LOG.atDebug() LOG.atDebug()
.setMessage("Disconnect - {} - {} - {} - {} peers left") .setMessage("Disconnect - active Connection? {} - {} - {} {} - {} {} - {} peers left")
.addArgument(initiatedByPeer ? "Inbound" : "Outbound") .addArgument(wasActiveConnection)
.addArgument(reason::toString) .addArgument(initiatedByPeer ? "Inbound" : "Outbound")
.addArgument(() -> connection.getPeer().getLoggableId()) .addArgument(reason::getValue)
.addArgument(ethPeers::peerCount) .addArgument(reason::name)
.log(); .addArgument(() -> connection.getPeer().getLoggableId())
LOG.atTrace().setMessage("{}").addArgument(ethPeers::toString).log(); .addArgument(() -> connection.getPeerInfo().getClientId())
} .addArgument(ethPeers::peerCount)
.log();
LOG.atTrace().setMessage("{}").addArgument(ethPeers::toString).log();
} }
private void handleStatusMessage(final EthPeer peer, final Message message) { private void handleStatusMessage(final EthPeer peer, final Message message) {

Loading…
Cancel
Save