Merge onUpdatedDataReceived and onNoSeedNodeAvailable to onBootstrapped

This commit is contained in:
chimp1984 2021-02-18 16:14:48 -05:00 committed by Christoph Atteneder
parent 44fcfb86bb
commit 49e9f72d6e
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
2 changed files with 4 additions and 13 deletions

View File

@ -258,7 +258,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
if (!seedNodesAvailable) {
isBootstrapped = true;
mailboxMessageService.onNoSeedNodeAvailable();
mailboxMessageService.onBootstrapped();
p2pServiceListeners.forEach(P2PServiceListener::onNoSeedNodeAvailable);
}
}
@ -321,7 +321,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
// We don't use a listener at mailboxMessageService as we require the correct
// order of execution. The p2pServiceListeners must be called after
// mailboxMessageService.onUpdatedDataReceived.
mailboxMessageService.onUpdatedDataReceived();
mailboxMessageService.onBootstrapped();
p2pServiceListeners.forEach(P2PServiceListener::onUpdatedDataReceived);
p2PDataStorage.onBootstrapComplete();
@ -330,7 +330,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
@Override
public void onNoSeedNodeAvailable() {
mailboxMessageService.onNoSeedNodeAvailable();
mailboxMessageService.onBootstrapped();
p2pServiceListeners.forEach(P2PServiceListener::onNoSeedNodeAvailable);
}

View File

@ -218,7 +218,7 @@ public class MailboxMessageService implements HashMapChangedListener, PersistedD
// We don't listen on requestDataManager directly as we require the correct
// order of execution. The p2pService is handling the correct order of execution and we get called
// directly from there.
public void onUpdatedDataReceived() {
public void onBootstrapped() {
if (!isBootstrapped) {
isBootstrapped = true;
// Only now we start listening and processing. The p2PDataStorage is our cache for data we have received
@ -228,15 +228,6 @@ public class MailboxMessageService implements HashMapChangedListener, PersistedD
}
}
public void onNoSeedNodeAvailable() {
if (!isBootstrapped) {
isBootstrapped = true;
// As we do not expect a updated data request response we start here with addHashMapChangedListenerAndApply
addHashMapChangedListenerAndApply();
maybeRepublishMailBoxMessages();
}
}
public void sendEncryptedMailboxMessage(NodeAddress peer,
PubKeyRing peersPubKeyRing,