Skip to content

Commit cfc9e28

Browse files
author
Stephane Landelle
committed
Merge pull request #820 from kullfar/1.9.x
Netty: Fix releasing limit for connections pool per host
2 parents caa9c01 + 198a52b commit cfc9e28

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/com/ning/http/client/providers/netty/channel/ChannelManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,11 @@ public void abortChannelPreemption(String poolKey) {
381381
getFreeConnectionsForHost(poolKey).release();
382382
}
383383

384-
public void registerOpenChannel(Channel channel) {
384+
public void registerOpenChannel(Channel channel, final String poolKey) {
385385
openChannels.add(channel);
386+
if (maxConnectionsPerHostEnabled) {
387+
channelId2KeyPool.put(channel.getId(), poolKey);
388+
}
386389
}
387390

388391
private HttpClientCodec newHttpClientCodec() {

src/main/java/com/ning/http/client/providers/netty/request/NettyConnectListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private void writeRequest(Channel channel, String poolKey) {
7373
if (future.getAsyncHandler() instanceof AsyncHandlerExtensions)
7474
AsyncHandlerExtensions.class.cast(future.getAsyncHandler()).onConnectionOpen();
7575

76-
channelManager.registerOpenChannel(channel);
76+
channelManager.registerOpenChannel(channel, poolKey);
7777
future.attachChannel(channel, false);
7878
requestSender.writeRequest(future, channel);
7979
}

0 commit comments

Comments
 (0)