mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-22 08:29:16 -04:00
WIP (testing)
This commit is contained in:
parent
a406a94976
commit
78a9662220
@ -61,7 +61,7 @@ public class ArbitratorService {
|
||||
log.debug("addArbitrator arbitrator.hashCode() " + arbitrator.hashCode());
|
||||
boolean result = p2PService.addData(arbitrator);
|
||||
if (result) {
|
||||
log.trace("Add arbitrator to network was successful. Arbitrator = " + arbitrator);
|
||||
log.trace("Add arbitrator to network was successful. Arbitrator.hashCode() = " + arbitrator.hashCode());
|
||||
resultHandler.handleResult();
|
||||
} else {
|
||||
errorMessageHandler.handleErrorMessage("Add arbitrator failed");
|
||||
@ -71,7 +71,7 @@ public class ArbitratorService {
|
||||
public void removeArbitrator(Arbitrator arbitrator, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
log.debug("removeArbitrator arbitrator.hashCode() " + arbitrator.hashCode());
|
||||
if (p2PService.removeData(arbitrator)) {
|
||||
log.trace("Remove arbitrator from network was successful. Arbitrator = " + arbitrator);
|
||||
log.trace("Remove arbitrator from network was successful. Arbitrator.hashCode() = " + arbitrator.hashCode());
|
||||
resultHandler.handleResult();
|
||||
} else {
|
||||
errorMessageHandler.handleErrorMessage("Remove arbitrator failed");
|
||||
|
@ -258,7 +258,7 @@ public class OpenOfferManager {
|
||||
|
||||
private void startRefreshOffersThread() {
|
||||
// refresh sufficiently before offer would expire
|
||||
refreshOffersPeriod = (long) (Offer.TTL * 0.7);
|
||||
refreshOffersPeriod = (long) (Offer.TTL * 0.5);
|
||||
refreshOffersTimer = UserThread.runPeriodically(OpenOfferManager.this::refreshOffers, refreshOffersPeriod, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
@ -274,6 +274,8 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
|
||||
isBootstrapped = true;
|
||||
p2pServiceListeners.stream().forEach(P2PServiceListener::onBootstrapComplete);
|
||||
|
||||
p2PDataStorage.onBootstrapComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,14 +61,12 @@ public class P2PDataStorage implements MessageListener, ConnectionListener {
|
||||
storage = new Storage<>(storageDir);
|
||||
removeExpiredEntriesExecutor = Utilities.getScheduledThreadPoolExecutor("removeExpiredEntries", 1, 10, 5);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
HashMap<ByteArray, MapValue> persisted = storage.initAndGetPersisted("SequenceNumberMap");
|
||||
if (persisted != null)
|
||||
sequenceNumberMap = getPurgedSequenceNumberMap(persisted);
|
||||
}
|
||||
|
||||
public void onBootstrapComplete() {
|
||||
removeExpiredEntriesExecutor.scheduleAtFixedRate(() -> UserThread.execute(() -> {
|
||||
log.trace("removeExpiredEntries");
|
||||
// The moment when an object becomes expired will not be synchronous in the network and we could
|
||||
@ -84,7 +82,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener {
|
||||
ByteArray hashOfPayload = entry.getKey();
|
||||
ProtectedData protectedData = map.get(hashOfPayload);
|
||||
toRemoveSet.add(protectedData);
|
||||
log.trace("remove protectedData:\n\t" + protectedData);
|
||||
log.error("remove protectedData:\n\t" + protectedData);
|
||||
map.remove(hashOfPayload);
|
||||
});
|
||||
|
||||
@ -240,6 +238,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener {
|
||||
checkIfStoredDataPubKeyMatchesNewDataPubKey(ownerPubKey, hashOfPayload);
|
||||
|
||||
if (result) {
|
||||
log.error("refreshDate called for storedData:\n\t" + StringUtils.abbreviate(storedData.toString(), 100));
|
||||
storedData.refreshDate();
|
||||
|
||||
sequenceNumberMap.put(hashOfPayload, new MapValue(sequenceNumber, System.currentTimeMillis()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user