forked from Qortal/qortal
Improve shutdown of Network.
Detect interrupt during peer connect so we can return without trying to set up new peer. Do join() after interrupt() in Network.shutdown.
This commit is contained in:
parent
c68e0eb6ea
commit
84f5935d38
@ -362,6 +362,9 @@ public class Network extends Thread {
|
||||
if (!newPeer.connect())
|
||||
return;
|
||||
|
||||
if (this.isInterrupted())
|
||||
return;
|
||||
|
||||
synchronized (this.connectedPeers) {
|
||||
this.connectedPeers.add(newPeer);
|
||||
}
|
||||
@ -824,6 +827,11 @@ public class Network extends Thread {
|
||||
peerExecutor.shutdownNow();
|
||||
|
||||
this.interrupt();
|
||||
try {
|
||||
this.join();
|
||||
} catch (InterruptedException e) {
|
||||
// We were interrupted while waiting for thread to join
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user