Skip to content

Commit

Permalink
PeerGroup.handlePeerDeath() don't check isRunning(). PeerGroup.stopAs…
Browse files Browse the repository at this point in the history
…ync() set downloadPeer to null before channels are stopped instead.
  • Loading branch information
oscarguindzberg committed Apr 2, 2019
1 parent c632506 commit 465a9ea
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions core/src/main/java/org/bitcoinj/core/PeerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ public ListenableFuture stopAsync() {
public void run() {
try {
log.info("Stopping ...");
setDownloadPeer(null);
// Blocking close of all sockets.
channels.stopAsync();
channels.awaitTerminated();
Expand Down Expand Up @@ -1841,12 +1842,6 @@ protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
if (newDownloadPeer != null) {
setDownloadPeer(newDownloadPeer);

// When using BlockingClient we get errors at shutdown caused by
// startBlockChainDownloadFromPeer()
// We add another check to terminate here if we have been shut down already
if (!isRunning())
return;

if (downloadListener != null) {
startBlockChainDownloadFromPeer(newDownloadPeer);
}
Expand Down

0 comments on commit 465a9ea

Please sign in to comment.