mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-03 18:56:59 +01:00
Improve/cleanup logs.
Only log lostAllConnections after numOnConnections > 2 to avoid logs at startup Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
c3acd5fb4a
commit
1030f891b9
3 changed files with 13 additions and 9 deletions
|
@ -595,7 +595,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
|
||||||
|
|
||||||
|
|
||||||
public boolean reportInvalidRequest(RuleViolation ruleViolation) {
|
public boolean reportInvalidRequest(RuleViolation ruleViolation) {
|
||||||
log.warn("We got reported the ruleViolation {} at connection {}", ruleViolation, this);
|
log.info("We got reported the ruleViolation {} at connection with address{} and uid {}", ruleViolation, this.getPeersNodeAddressProperty(), this.getUid());
|
||||||
int numRuleViolations;
|
int numRuleViolations;
|
||||||
numRuleViolations = ruleViolations.getOrDefault(ruleViolation, 0);
|
numRuleViolations = ruleViolations.getOrDefault(ruleViolation, 0);
|
||||||
|
|
||||||
|
@ -603,11 +603,11 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
|
||||||
ruleViolations.put(ruleViolation, numRuleViolations);
|
ruleViolations.put(ruleViolation, numRuleViolations);
|
||||||
|
|
||||||
if (numRuleViolations >= ruleViolation.maxTolerance) {
|
if (numRuleViolations >= ruleViolation.maxTolerance) {
|
||||||
log.warn("We close connection as we received too many corrupt requests.\n" +
|
log.warn("We close connection as we received too many corrupt requests. " +
|
||||||
"numRuleViolations={}\n\t" +
|
"numRuleViolations={} " +
|
||||||
"corruptRequest={}\n\t" +
|
"corruptRequest={} " +
|
||||||
"corruptRequests={}\n\t" +
|
"corruptRequests={} " +
|
||||||
"connection={}", numRuleViolations, ruleViolation, ruleViolations, this);
|
"connection with address{} and uid {}", numRuleViolations, ruleViolation, ruleViolations, this.getPeersNodeAddressProperty(), this.getUid());
|
||||||
this.ruleViolation = ruleViolation;
|
this.ruleViolation = ruleViolation;
|
||||||
if (ruleViolation == RuleViolation.PEER_BANNED) {
|
if (ruleViolation == RuleViolation.PEER_BANNED) {
|
||||||
log.warn("We close connection due RuleViolation.PEER_BANNED. peersNodeAddress={}", getPeersNodeAddressOptional());
|
log.warn("We close connection due RuleViolation.PEER_BANNED. peersNodeAddress={}", getPeersNodeAddressOptional());
|
||||||
|
|
|
@ -84,6 +84,7 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||||
private static final boolean PRINT_REPORTED_PEERS_DETAILS = true;
|
private static final boolean PRINT_REPORTED_PEERS_DETAILS = true;
|
||||||
private Timer printStatisticsTimer;
|
private Timer printStatisticsTimer;
|
||||||
private boolean shutDownRequested;
|
private boolean shutDownRequested;
|
||||||
|
private int numOnConnections;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -216,6 +217,8 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||||
|
|
||||||
doHouseKeeping();
|
doHouseKeeping();
|
||||||
|
|
||||||
|
numOnConnections++;
|
||||||
|
|
||||||
if (lostAllConnections) {
|
if (lostAllConnections) {
|
||||||
lostAllConnections = false;
|
lostAllConnections = false;
|
||||||
stopped = false;
|
stopped = false;
|
||||||
|
@ -238,7 +241,8 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||||
boolean previousLostAllConnections = lostAllConnections;
|
boolean previousLostAllConnections = lostAllConnections;
|
||||||
lostAllConnections = networkNode.getAllConnections().isEmpty();
|
lostAllConnections = networkNode.getAllConnections().isEmpty();
|
||||||
|
|
||||||
if (lostAllConnections) {
|
// At start-up we ignore if we would lose a connection and would fall back to no connections
|
||||||
|
if (lostAllConnections && numOnConnections > 2) {
|
||||||
stopped = true;
|
stopped = true;
|
||||||
|
|
||||||
if (!shutDownRequested) {
|
if (!shutDownRequested) {
|
||||||
|
@ -562,7 +566,7 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||||
|
|
||||||
if (!candidates.isEmpty()) {
|
if (!candidates.isEmpty()) {
|
||||||
Connection connection = candidates.remove(0);
|
Connection connection = candidates.remove(0);
|
||||||
log.info("checkMaxConnections: Num candidates for shut down={}. We close oldest connection to peer {}",
|
log.info("checkMaxConnections: Num candidates (inbound/peer) for shut down={}. We close oldest connection to peer {}",
|
||||||
candidates.size(), connection.getPeersNodeAddressOptional());
|
candidates.size(), connection.getPeersNodeAddressOptional());
|
||||||
if (!connection.isStopped()) {
|
if (!connection.isStopped()) {
|
||||||
connection.shutDown(CloseConnectionReason.TOO_MANY_CONNECTIONS_OPEN,
|
connection.shutDown(CloseConnectionReason.TOO_MANY_CONNECTIONS_OPEN,
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class GetDataRequestHandler {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NotNull Throwable throwable) {
|
public void onFailure(@NotNull Throwable throwable) {
|
||||||
if (!stopped) {
|
if (!stopped) {
|
||||||
String errorMessage = "Sending getDataRequest to " + connection +
|
String errorMessage = "Sending getDataResponse to " + connection +
|
||||||
" failed. That is expected if the peer is offline. getDataResponse=" + getDataResponse + "." +
|
" failed. That is expected if the peer is offline. getDataResponse=" + getDataResponse + "." +
|
||||||
"Exception: " + throwable.getMessage();
|
"Exception: " + throwable.getMessage();
|
||||||
handleFault(errorMessage, CloseConnectionReason.SEND_MSG_FAILURE, connection);
|
handleFault(errorMessage, CloseConnectionReason.SEND_MSG_FAILURE, connection);
|
||||||
|
|
Loading…
Add table
Reference in a new issue