Skip to content

Commit 19f7f49

Browse files
committed
Revert back AsyncHttpClient#844 and detach channel in finishUpdate, close AsyncHttpClient#844
1 parent ac90c8b commit 19f7f49

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/future/NettyResponseFuture.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ public void attachChannel(Channel channel, boolean reuseChannel) {
388388
this.reuseChannel = reuseChannel;
389389
}
390390

391+
public void detachChannel() {
392+
this.channel = null;
393+
this.reuseChannel = false;
394+
}
395+
391396
public Channel channel() {
392397
return channel;
393398
}

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/handler/HttpProtocol.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ private void addType3NTLMAuthorizationHeader(String auth, FluentCaseInsensitiveS
189189

190190
private void finishUpdate(final NettyResponseFuture<?> future, Channel channel, boolean expectOtherChunks) throws IOException {
191191

192-
markAsDone(future, channel);
192+
future.detachChannel();
193193

194194
boolean keepAlive = future.isKeepAlive();
195195
if (expectOtherChunks && keepAlive)
196196
channelManager.drainChannelAndOffer(channel, future);
197197
else
198198
channelManager.tryToOfferChannelToPool(channel, keepAlive, future.getPartitionId());
199+
200+
markAsDone(future, channel);
199201
}
200202

201203
private boolean updateBodyAndInterrupt(NettyResponseFuture<?> future, AsyncHandler<?> handler, NettyResponseBodyPart bodyPart)

providers/netty4/src/main/java/org/asynchttpclient/providers/netty4/future/NettyResponseFuture.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ public void attachChannel(Channel channel, boolean reuseChannel) {
388388
this.reuseChannel = reuseChannel;
389389
}
390390

391+
public void detachChannel() {
392+
this.channel = null;
393+
this.reuseChannel = false;
394+
}
395+
391396
public Channel channel() {
392397
return channel;
393398
}

providers/netty4/src/main/java/org/asynchttpclient/providers/netty4/handler/HttpProtocol.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,15 @@ private void addType3NTLMAuthorizationHeader(String authenticateHeader, FluentCa
190190

191191
private void finishUpdate(final NettyResponseFuture<?> future, Channel channel, boolean expectOtherChunks) throws IOException {
192192

193-
markAsDone(future, channel);
193+
future.detachChannel();
194194

195195
boolean keepAlive = future.isKeepAlive();
196196
if (expectOtherChunks && keepAlive)
197197
channelManager.drainChannelAndOffer(channel, future);
198198
else
199199
channelManager.tryToOfferChannelToPool(channel, keepAlive, future.getPartitionId());
200+
201+
markAsDone(future, channel);
200202
}
201203

202204
private boolean updateBodyAndInterrupt(NettyResponseFuture<?> future, AsyncHandler<?> handler, NettyResponseBodyPart bodyPart) throws Exception {

0 commit comments

Comments
 (0)