mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
fix mailbox bootstrap issue
This commit is contained in:
parent
411395bf94
commit
f936210717
2 changed files with 15 additions and 9 deletions
|
@ -334,12 +334,14 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||||
|
|
||||||
p2PDataStorage.onBootstrapped();
|
p2PDataStorage.onBootstrapped();
|
||||||
|
|
||||||
|
// We don't use a listener at mailboxMessageService as we require the correct
|
||||||
|
// order of execution. The mailboxMessageService must be called before.
|
||||||
|
mailboxMessageService.onBootstrapped();
|
||||||
|
|
||||||
// Once we have applied the state in the P2P domain we notify our listeners
|
// Once we have applied the state in the P2P domain we notify our listeners
|
||||||
p2pServiceListeners.forEach(listenerHandler);
|
p2pServiceListeners.forEach(listenerHandler);
|
||||||
|
|
||||||
// We don't use a listener at mailboxMessageService as we require the correct
|
mailboxMessageService.initAfterBootstrapped();
|
||||||
// order of execution. The p2pServiceListeners must be called before.
|
|
||||||
mailboxMessageService.onBootstrapped();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,13 +221,18 @@ public class MailboxMessageService implements HashMapChangedListener, PersistedD
|
||||||
public void onBootstrapped() {
|
public void onBootstrapped() {
|
||||||
if (!isBootstrapped) {
|
if (!isBootstrapped) {
|
||||||
isBootstrapped = true;
|
isBootstrapped = true;
|
||||||
// Only now we start listening and processing. The p2PDataStorage is our cache for data we have received
|
|
||||||
// after the hidden service was ready.
|
|
||||||
addHashMapChangedListenerAndApply();
|
|
||||||
maybeRepublishMailBoxMessages();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// second stage starup for MailboxMessageService ... apply existing messages to their modules
|
||||||
|
public void initAfterBootstrapped() {
|
||||||
|
// Only now we start listening and processing. The p2PDataStorage is our cache for data we have received
|
||||||
|
// after the hidden service was ready.
|
||||||
|
addHashMapChangedListener();
|
||||||
|
onAdded(p2PDataStorage.getMap().values());
|
||||||
|
maybeRepublishMailBoxMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendEncryptedMailboxMessage(NodeAddress peer,
|
public void sendEncryptedMailboxMessage(NodeAddress peer,
|
||||||
PubKeyRing peersPubKeyRing,
|
PubKeyRing peersPubKeyRing,
|
||||||
|
@ -374,9 +379,8 @@ public class MailboxMessageService implements HashMapChangedListener, PersistedD
|
||||||
// Private
|
// Private
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void addHashMapChangedListenerAndApply() {
|
private void addHashMapChangedListener() {
|
||||||
p2PDataStorage.addHashMapChangedListener(this);
|
p2PDataStorage.addHashMapChangedListener(this);
|
||||||
onAdded(p2PDataStorage.getMap().values());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processSingleMailboxEntry(Collection<ProtectedMailboxStorageEntry> protectedMailboxStorageEntries) {
|
private void processSingleMailboxEntry(Collection<ProtectedMailboxStorageEntry> protectedMailboxStorageEntries) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue