mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-18 13:25:14 +01:00
Cleanups
This commit is contained in:
parent
07354191a6
commit
b80b6ec836
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user