mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Improve logging, cleanups
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
32f2f0ab76
commit
86723cf85a
@ -59,10 +59,14 @@ class ProtoOutputStream {
|
||||
}
|
||||
|
||||
private void writeEnvelopeOrThrow(NetworkEnvelope envelope) throws IOException {
|
||||
long ts = System.currentTimeMillis();
|
||||
protobuf.NetworkEnvelope proto = envelope.toProtoNetworkEnvelope();
|
||||
proto.writeDelimitedTo(delegate);
|
||||
delegate.flush();
|
||||
|
||||
long duration = System.currentTimeMillis() - ts;
|
||||
if (duration > 10000) {
|
||||
log.info("Sending {} to peer took {} sec.", envelope.getClass().getSimpleName(), duration / 1000d);
|
||||
}
|
||||
statistic.addSentBytes(proto.getSerializedSize());
|
||||
statistic.addSentMessage(envelope);
|
||||
|
||||
|
@ -98,15 +98,11 @@ public class GetDataRequestHandler {
|
||||
connection.getCapabilities());
|
||||
|
||||
if (wasPersistableNetworkPayloadsTruncated.get()) {
|
||||
log.warn("The getData request from peer with {} caused too much PersistableNetworkPayload " +
|
||||
"entries to get delivered. We limited the entries for the response to {} entries",
|
||||
connectionInfo, MAX_ENTRIES);
|
||||
log.warn("The getDataResponse for peer {} got truncated.", connectionInfo);
|
||||
}
|
||||
|
||||
if (wasProtectedStorageEntriesTruncated.get()) {
|
||||
log.warn("The getData request from peer with {} caused too much ProtectedStorageEntry " +
|
||||
"entries to get delivered. We limited the entries for the response to {} entries",
|
||||
connectionInfo, MAX_ENTRIES);
|
||||
log.warn("The getDataResponse for peer {} got truncated.", connectionInfo);
|
||||
}
|
||||
|
||||
log.info("The getDataResponse to peer with {} contains {} ProtectedStorageEntries and {} PersistableNetworkPayloads",
|
||||
|
@ -125,7 +125,10 @@ public final class GetDataResponse extends NetworkEnvelope implements SupportedC
|
||||
public static GetDataResponse fromProto(protobuf.GetDataResponse proto,
|
||||
NetworkProtoResolver resolver,
|
||||
int messageVersion) {
|
||||
log.info("Received a GetDataResponse with {}", Utilities.readableFileSize(proto.getSerializedSize()));
|
||||
boolean wasTruncated = proto.getWasTruncated();
|
||||
log.info("Received a GetDataResponse with {} {}",
|
||||
Utilities.readableFileSize(proto.getSerializedSize()),
|
||||
wasTruncated ? " (was truncated)" : "");
|
||||
Set<ProtectedStorageEntry> dataSet = proto.getDataSetList().stream()
|
||||
.map(entry -> (ProtectedStorageEntry) resolver.fromProto(entry)).collect(Collectors.toSet());
|
||||
Set<PersistableNetworkPayload> persistableNetworkPayloadSet = proto.getPersistableNetworkPayloadItemsList().stream()
|
||||
@ -134,7 +137,7 @@ public final class GetDataResponse extends NetworkEnvelope implements SupportedC
|
||||
persistableNetworkPayloadSet,
|
||||
proto.getRequestNonce(),
|
||||
proto.getIsGetUpdatedDataResponse(),
|
||||
proto.getWasTruncated(),
|
||||
wasTruncated,
|
||||
Capabilities.fromIntList(proto.getSupportedCapabilitiesList()),
|
||||
messageVersion);
|
||||
}
|
||||
|
@ -284,18 +284,9 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
|
||||
// PersistedStoragePayload items don't get removed, so we don't have an issue with the case that
|
||||
// an object gets removed in between PreliminaryGetDataRequest and the GetUpdatedDataRequest and we would
|
||||
// miss that event if we do not load the full set or use some delta handling.
|
||||
|
||||
Map<ByteArray, PersistableNetworkPayload> mapForDataRequest = getMapForDataRequest();
|
||||
Set<byte[]> excludedKeys = getKeysAsByteSet(mapForDataRequest);
|
||||
/* log.trace("## getKnownPayloadHashes map of PersistableNetworkPayloads={}, excludedKeys={}",
|
||||
printPersistableNetworkPayloadMap(mapForDataRequest),
|
||||
excludedKeys.stream().map(Utilities::encodeToHex).toArray());*/
|
||||
|
||||
Set<byte[]> excludedKeysFromProtectedStorageEntryMap = getKeysAsByteSet(map);
|
||||
/*log.trace("## getKnownPayloadHashes map of ProtectedStorageEntrys={}, excludedKeys={}",
|
||||
printMap(),
|
||||
excludedKeysFromProtectedStorageEntryMap.stream().map(Utilities::encodeToHex).toArray());*/
|
||||
|
||||
excludedKeys.addAll(excludedKeysFromProtectedStorageEntryMap);
|
||||
return excludedKeys;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user