mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Improve log
This commit is contained in:
parent
1603e01bfc
commit
67134651ee
1 changed files with 24 additions and 20 deletions
|
@ -140,31 +140,35 @@ public class RequestBlocksHandler implements MessageListener {
|
|||
|
||||
@Override
|
||||
public void onMessage(NetworkEnvelope networkEnvelop, Connection connection) {
|
||||
if (connection.getPeersNodeAddressOptional().isPresent() && connection.getPeersNodeAddressOptional().get().equals(peersNodeAddress)) {
|
||||
if (networkEnvelop instanceof GetBsqBlocksResponse) {
|
||||
Log.traceCall(networkEnvelop.toString() + "\n\tconnection=" + connection);
|
||||
if (!stopped) {
|
||||
GetBsqBlocksResponse getBsqBlocksResponse = (GetBsqBlocksResponse) networkEnvelop;
|
||||
if (getBsqBlocksResponse.getRequestNonce() == nonce) {
|
||||
stopTimeoutTimer();
|
||||
checkArgument(connection.getPeersNodeAddressOptional().isPresent(),
|
||||
"RequestDataHandler.onMessage: connection.getPeersNodeAddressOptional() must be present " +
|
||||
"at that moment");
|
||||
cleanup();
|
||||
listener.onComplete(getBsqBlocksResponse);
|
||||
if (connection.getPeersNodeAddressOptional().isPresent()) {
|
||||
if (connection.getPeersNodeAddressOptional().get().equals(peersNodeAddress)) {
|
||||
if (networkEnvelop instanceof GetBsqBlocksResponse) {
|
||||
Log.traceCall(networkEnvelop.toString() + "\n\tconnection=" + connection);
|
||||
if (!stopped) {
|
||||
GetBsqBlocksResponse getBsqBlocksResponse = (GetBsqBlocksResponse) networkEnvelop;
|
||||
if (getBsqBlocksResponse.getRequestNonce() == nonce) {
|
||||
stopTimeoutTimer();
|
||||
checkArgument(connection.getPeersNodeAddressOptional().isPresent(),
|
||||
"RequestDataHandler.onMessage: connection.getPeersNodeAddressOptional() must be present " +
|
||||
"at that moment");
|
||||
cleanup();
|
||||
listener.onComplete(getBsqBlocksResponse);
|
||||
} else {
|
||||
log.warn("Nonce not matching. That can happen rarely if we get a response after a canceled " +
|
||||
"handshake (timeout causes connection close but peer might have sent a msg before " +
|
||||
"connection was closed).\n\t" +
|
||||
"We drop that message. nonce={} / requestNonce={}",
|
||||
nonce, getBsqBlocksResponse.getRequestNonce());
|
||||
}
|
||||
} else {
|
||||
log.warn("Nonce not matching. That can happen rarely if we get a response after a canceled " +
|
||||
"handshake (timeout causes connection close but peer might have sent a msg before " +
|
||||
"connection was closed).\n\t" +
|
||||
"We drop that message. nonce={} / requestNonce={}",
|
||||
nonce, getBsqBlocksResponse.getRequestNonce());
|
||||
log.warn("We have stopped already. We ignore that onDataRequest call.");
|
||||
}
|
||||
} else {
|
||||
log.warn("We have stopped already. We ignore that onDataRequest call.");
|
||||
}
|
||||
} else {
|
||||
log.warn("We got a message from another connection and ignore it. That should never happen.");
|
||||
}
|
||||
} else {
|
||||
log.warn("We got a message from another connection and ignore it. That should never happen.");
|
||||
log.debug("Peers node address is not set yet.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue