Don't inform the API user of peer disconnects or select a new download peer when a PeerGroup is being terminated. Fixes issue 95.

This commit is contained in:
Mike Hearn
2011-10-24 12:44:26 +00:00
parent 7a834cad6e
commit 55273576cf

View File

@@ -323,8 +323,13 @@ public class PeerGroup {
log.error("Unexpected exception whilst talking to " + peer, ex);
}
} finally {
// In all cases, disconnect and put the address back on the queue.
// We will retry this peer after all other peers have been tried.
// We may be terminating because of a controlled shutdown. If so, don't inform the user of individual
// peer connections or select a new download peer.
if (!running)
return;
// Disconnect and put the address back on the queue. We will retry this peer after all
// other peers have been tried.
peer.disconnect();
// We may not know the address if the peer was added directly.