mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Wait for mailbox send before stopping peer in network stress test
Otherwise the peer may be already stopped before sending.
This commit is contained in:
parent
ea35ace8db
commit
1a496e0963
1 changed files with 7 additions and 0 deletions
|
@ -402,6 +402,7 @@ public class NetworkStressTest {
|
|||
// The first online peer sends messages to random other peers.
|
||||
final P2PService onlinePeer = peerNodes.get(firstOnline);
|
||||
final NodeAddress onlinePeerAddress = onlinePeer.getAddress();
|
||||
final CountDownLatch sendLatch = new CountDownLatch(mailboxCount);
|
||||
for (int i = 0; i < mailboxCount; i++) {
|
||||
// Select a random peer (different than source one)...
|
||||
int peerIdx;
|
||||
|
@ -418,18 +419,24 @@ public class NetworkStressTest {
|
|||
new SendMailboxMessageListener() { // checked in receiver
|
||||
@Override
|
||||
public void onArrived() {
|
||||
sendLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStoredInMailbox() {
|
||||
sendLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMessage) {
|
||||
sentMailboxFailed.set(true);
|
||||
sendLatch.countDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
// TODO: Use meaningful timeout.
|
||||
assertLatch("timed out while sending from peer " + firstOnline,
|
||||
sendLatch, 2 * mailboxCount, TimeUnit.SECONDS);
|
||||
|
||||
// When done, put first online peer offline.
|
||||
final CountDownLatch stopLatch = new CountDownLatch(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue