Skip to content

Commit e6e89bc

Browse files
committed
Closeable channels were not closed
1 parent e46b2b7 commit e6e89bc

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

client/src/main/java/org/asynchttpclient/netty/channel/pool/DefaultChannelPool.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,20 @@ private final List<IdleChannel> closeChannels(List<IdleChannel> candidates) {
166166
List<IdleChannel> closedChannels = null;
167167
for (int i = 0; i < candidates.size(); i++) {
168168
IdleChannel idleChannel = candidates.get(i);
169-
if (!isChannelCloseable(idleChannel.channel))
170-
if (isChannelCloseable(idleChannel.channel)) {
171-
LOGGER.debug("Closing Idle Channel {}", idleChannel.channel);
172-
close(idleChannel.channel);
173-
if (closedChannels != null) {
174-
closedChannels.add(idleChannel);
175-
}
176-
177-
} else if (closedChannels == null) {
178-
// first non closeable to be skipped, copy all
179-
// previously skipped closeable channels
180-
closedChannels = new ArrayList<>(candidates.size());
181-
for (int j = 0; j < i; j++)
182-
closedChannels.add(candidates.get(j));
169+
if (isChannelCloseable(idleChannel.channel)) {
170+
LOGGER.debug("Closing Idle Channel {}", idleChannel.channel);
171+
close(idleChannel.channel);
172+
if (closedChannels != null) {
173+
closedChannels.add(idleChannel);
183174
}
175+
176+
} else if (closedChannels == null) {
177+
// first non closeable to be skipped, copy all
178+
// previously skipped closeable channels
179+
closedChannels = new ArrayList<>(candidates.size());
180+
for (int j = 0; j < i; j++)
181+
closedChannels.add(candidates.get(j));
182+
}
184183
}
185184

186185
return closedChannels != null ? closedChannels : candidates;

0 commit comments

Comments
 (0)