This commit is contained in:
chimp1984 2021-10-21 10:12:57 +02:00
parent 07354191a6
commit b80b6ec836
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
3 changed files with 4 additions and 10 deletions

View File

@ -19,6 +19,7 @@ package bisq.monitor.metric;
import bisq.monitor.Reporter;
import bisq.core.offer.OfferUtil;
import bisq.core.offer.bisq_v1.OfferPayload;
import bisq.network.p2p.NodeAddress;
@ -144,10 +145,8 @@ public class P2PMarketStats extends P2PSeedNodeSnapshotBase {
public void log(Object message) {
if (message instanceof OfferPayload) {
OfferPayload currentMessage = (OfferPayload) message;
String version = "v" + currentMessage.getId().substring(currentMessage.getId().lastIndexOf("-") + 1);
OfferPayload offerPayload = (OfferPayload) message;
String version = "v" + OfferUtil.getVersionFromId(offerPayload.getId());
buckets.putIfAbsent(version, new Aggregator());
buckets.get(version).increment();
}

View File

@ -197,11 +197,6 @@ public class P2PNetworkLoad extends Metric implements MessageListener, SetupList
private static class Counter {
private int value = 1;
/**
* atomic get and reset
*
* @return the current value
*/
synchronized int getAndReset() {
try {
return value;

View File

@ -231,7 +231,7 @@ public class BroadcastHandler implements PeerManager.Listener {
return broadcastRequests.stream()
.filter(broadcastRequest -> !connection.getPeersNodeAddressOptional().isPresent() ||
!connection.getPeersNodeAddressOptional().get().equals(broadcastRequest.getSender()))
.filter(broadcastRequest -> connection.noCapabilityRequiredOrCapabilityIsSupported(broadcastRequest.getMessage()))
.filter(broadcastRequest -> connection.testCapability(broadcastRequest.getMessage()))
.collect(Collectors.toList());
}