mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Add numAllConnectionsLostEvents
This commit is contained in:
parent
8c156eb5bf
commit
5bdc5abe34
@ -157,6 +157,7 @@ public class GetInventoryRequestHandler implements MessageListener {
|
||||
inventory.put(InventoryItem.maxConnections, String.valueOf(maxConnections));
|
||||
inventory.put(InventoryItem.numConnections, String.valueOf(networkNode.getAllConnections().size()));
|
||||
inventory.put(InventoryItem.peakNumConnections, String.valueOf(peerManager.getPeakNumConnections()));
|
||||
inventory.put(InventoryItem.numAllConnectionsLostEvents, String.valueOf(peerManager.getNumAllConnectionsLostEvents()));
|
||||
inventory.put(InventoryItem.sentBytes, String.valueOf(Statistic.totalSentBytesProperty().get()));
|
||||
inventory.put(InventoryItem.sentBytesPerSec, String.valueOf(Statistic.totalSentBytesPerSecProperty().get()));
|
||||
inventory.put(InventoryItem.receivedBytes, String.valueOf(Statistic.totalReceivedBytesProperty().get()));
|
||||
|
@ -43,6 +43,7 @@ public enum InventoryItem {
|
||||
maxConnections("maxConnections", Integer.class, 0.33, 3, 0.4, 2.5),
|
||||
numConnections("numConnections", Integer.class, 0.33, 3, 0.4, 2.5),
|
||||
peakNumConnections("peakNumConnections", Integer.class, 0.33, 3, 0.4, 2.5),
|
||||
numAllConnectionsLostEvents("numAllConnectionsLostEvents", Integer.class, 0.9, 1.1, 0.95, 1.05),
|
||||
sentBytes("sentBytes", Long.class, 0, 5, 0, 4),
|
||||
sentBytesPerSec("sentBytesPerSec", Double.class, 0, 3, 0, 2),
|
||||
receivedBytes("receivedBytes", Long.class, 0, 5, 0, 4),
|
||||
|
@ -288,7 +288,7 @@ public class InventoryWebServer {
|
||||
addInventoryItem("Max. connections: ", requestInfo, averageValues, sb, InventoryItem.maxConnections);
|
||||
addInventoryItem("Number of connections: ", requestInfo, averageValues, sb, InventoryItem.numConnections);
|
||||
addInventoryItem("Peak number of connections: ", requestInfo, averageValues, sb, InventoryItem.peakNumConnections);
|
||||
|
||||
addInventoryItem("Number of 'All connections lost' events: ", requestInfo, averageValues, sb, InventoryItem.numAllConnectionsLostEvents);
|
||||
addInventoryItem("Sent messages/sec: ", requestInfo, averageValues, sb, InventoryItem.sentMessagesPerSec,
|
||||
value -> String.valueOf(MathUtils.roundDouble(Double.parseDouble(value), 2)));
|
||||
addInventoryItem("Received messages/sec: ", requestInfo, averageValues, sb, InventoryItem.receivedMessagesPerSec,
|
||||
|
@ -130,6 +130,8 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||
private int peakNumConnections;
|
||||
@Setter
|
||||
private boolean allowDisconnectSeedNodes;
|
||||
@Getter
|
||||
private int numAllConnectionsLostEvents;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -208,6 +210,9 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||
if (lostAllConnections) {
|
||||
lostAllConnections = false;
|
||||
stopped = false;
|
||||
log.info("\n------------------------------------------------------------\n" +
|
||||
"Established a new connection from/to {} after all connections lost.\n" +
|
||||
"------------------------------------------------------------", connection.getPeersNodeAddressOptional());
|
||||
listeners.forEach(Listener::onNewConnectionAfterAllConnectionsLost);
|
||||
}
|
||||
connection.getPeersNodeAddressOptional()
|
||||
@ -220,13 +225,22 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
||||
log.info("onDisconnect called: nodeAddress={}, closeConnectionReason={}",
|
||||
connection.getPeersNodeAddressOptional(), closeConnectionReason);
|
||||
handleConnectionFault(connection);
|
||||
|
||||
boolean previousLostAllConnections = lostAllConnections;
|
||||
lostAllConnections = networkNode.getAllConnections().isEmpty();
|
||||
|
||||
// If we enter to 'All connections lost' we count the event.
|
||||
if (!previousLostAllConnections && lostAllConnections) {
|
||||
numAllConnectionsLostEvents++;
|
||||
}
|
||||
|
||||
if (lostAllConnections) {
|
||||
stopped = true;
|
||||
log.warn("\n------------------------------------------------------------\n" +
|
||||
"All connections lost\n" +
|
||||
"------------------------------------------------------------");
|
||||
listeners.forEach(Listener::onAllConnectionsLost);
|
||||
|
||||
}
|
||||
maybeRemoveBannedPeer(closeConnectionReason, connection);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user