mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-13 11:36:15 +01:00
Duplicate channel futures list before closing channels.
Resolves issue 221
This commit is contained in:
parent
bc47fccaeb
commit
c5caeaea74
1 changed files with 6 additions and 3 deletions
|
@ -501,10 +501,13 @@ public class PeerGroup {
|
|||
synchronized (PeerGroup.this) {
|
||||
running = false;
|
||||
shutdownPeerDiscovery();
|
||||
LinkedList<ChannelFuture> futures;
|
||||
synchronized (channelFutures) {
|
||||
for (ChannelFuture future : channelFutures.values()) {
|
||||
future.getChannel().close();
|
||||
}
|
||||
// Copy the list here because the act of closing the channel modifies the channelFutures map.
|
||||
futures = new LinkedList<ChannelFuture>(channelFutures.values());
|
||||
}
|
||||
for (ChannelFuture future : futures) {
|
||||
future.getChannel().close();
|
||||
}
|
||||
bootstrap.releaseExternalResources();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue