mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-22 08:29:16 -04:00
Example restarting of peer in network stress test
This mechanism will be used for the mailbox send test.
This commit is contained in:
parent
4a264dbdc7
commit
444f9d90b8
@ -309,6 +309,52 @@ public class NetworkStressTest {
|
||||
// (so it can get its mailbox messages),
|
||||
// and the new first online node sends messages.
|
||||
// This is repeated until all nodes have been online and offline.
|
||||
final CountDownLatch shutDownLatch = new CountDownLatch(1);
|
||||
P2PService peer = peerNodes.get(0);
|
||||
peer.shutDown(shutDownLatch::countDown);
|
||||
shutDownLatch.await();
|
||||
|
||||
peer = createPeerNode(0, peerPorts.get(0));
|
||||
peerNodes.set(0, peer);
|
||||
final CountDownLatch bootLatch = new CountDownLatch(1);
|
||||
peer.start(new P2PServiceListener() {
|
||||
@Override
|
||||
public void onRequestingDataCompleted() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoSeedNodeAvailable() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoPeersAvailable() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBootstrapComplete() {
|
||||
bootLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTorNodeReady() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHiddenServicePublished() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetupFailed(Throwable throwable) {
|
||||
|
||||
}
|
||||
});
|
||||
bootLatch.await();
|
||||
|
||||
for (int firstOnline = 0, firstOffline = (int)Math.ceil(nPeers/2.0);
|
||||
firstOnline < nPeers;
|
||||
firstOnline++, firstOffline = ++firstOffline%nPeers) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user