Skip to content

Commit

Permalink
Update some logs messages and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoreliovlabs committed Nov 1, 2023
1 parent cc65c07 commit cc48ea8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rskj-core/src/main/java/co/rsk/net/discovery/PeerExplorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ synchronized void handleMessage(DiscoveryEvent event) {
"type: [{}], " +
"networkId: [{}]",
state, event.getMessage().getMessageType(),
event.getMessage().getNetworkId().isPresent() ? event.getMessage().getNetworkId().getAsInt() : null);
event.getMessage().getNetworkId().isPresent());

if (state != ExecState.RUNNING) {
logger.warn("Cannot handle message as current state is {}", state);
Expand All @@ -178,7 +178,7 @@ synchronized void handleMessage(DiscoveryEvent event) {
if (event.getMessage().getNetworkId().isPresent() &&
event.getMessage().getNetworkId().getAsInt() != this.networkId) {
logger.warn("handleMessage - Message ignored because remote peer's network id: [{}] is different from local network id: [{}]",
event.getMessage().getNetworkId().getAsInt(), this.networkId);
event.getMessage().getNetworkId(), this.networkId);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
return;
}
if (type == DiscoveryMessageType.PING) {
Expand Down Expand Up @@ -246,7 +246,7 @@ private void handleFindNode(FindNodePeerMessage message) {
this.sendNeighbors(connectedNode.getAddress(), nodesToSend, message.getMessageId());
updateEntry(connectedNode);
} else {
logger.warn("handleFindNode - Node with id [{}] is null", nodeId);
logger.warn("handleFindNode - Node with id: [{}] is not connected. Ignored", nodeId);
}
}

Expand Down Expand Up @@ -274,7 +274,7 @@ private void handleNeighborsMessage(InetSocketAddress neighborsResponseAddress,
}
updateEntry(connectedNode);
} else {
logger.warn("handleFindNode - Node with id [{}] is null", nodeId);
logger.warn("handleFindNode - Node with id: [{}] is not connected. Ignored", nodeId);
}
}

Expand All @@ -290,7 +290,7 @@ synchronized PingPeerMessage sendPing(InetSocketAddress nodeAddress, int attempt
PingPeerMessage nodeMessage = checkPendingPeerToAddress(nodeAddress);

if (nodeMessage != null) {
logger.warn("sendPing - Node message to address [{}/{}] is null", nodeAddress.getHostName(), nodeAddress.getPort());
logger.warn("sendPing - No ping message has been sent to address: [{}/{}], as there's pending one", nodeAddress.getHostName(), nodeAddress.getPort());

return nodeMessage;
}
Expand Down

0 comments on commit cc48ea8

Please sign in to comment.