Skip to content

Commit

Permalink
PeerGroup: Add additional check isRunning() at handlePeerDeath to avo…
Browse files Browse the repository at this point in the history
…id errors at shutDown when using BlockingClient

Cherry pick 4fed629
  • Loading branch information
ManfredKarrer authored and oscarguindzberg committed Feb 12, 2019
1 parent 3f1382d commit f76d341
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/java/org/bitcoinj/core/PeerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,13 @@ protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) {
final Peer newDownloadPeer = selectDownloadPeer(peers);
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 f76d341

Please sign in to comment.