Skip to content

Commit 9b91611

Browse files
committed
Cancel timeouts asap, close AsyncHttpClient#848
1 parent 4e18ad6 commit 9b91611

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ private V getContent() throws ExecutionException {
199199

200200
private boolean terminateAndExit() {
201201
cancelTimeouts();
202+
this.channel = null;
203+
this.reuseChannel = false;
202204
return isDone.getAndSet(true) || isCancelled.get();
203205
}
204206

@@ -388,11 +390,6 @@ public void attachChannel(Channel channel, boolean reuseChannel) {
388390
this.reuseChannel = reuseChannel;
389391
}
390392

391-
public void detachChannel() {
392-
this.channel = null;
393-
this.reuseChannel = false;
394-
}
395-
396393
public Channel channel() {
397394
return channel;
398395
}

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

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

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

192-
future.detachChannel();
192+
future.cancelTimeouts();
193193

194194
boolean keepAlive = future.isKeepAlive();
195195
if (expectOtherChunks && keepAlive)

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ private V getContent() throws ExecutionException {
199199

200200
private boolean terminateAndExit() {
201201
cancelTimeouts();
202+
this.channel = null;
203+
this.reuseChannel = false;
202204
return isDone.getAndSet(true) || isCancelled.get();
203205
}
204206

@@ -388,11 +390,6 @@ public void attachChannel(Channel channel, boolean reuseChannel) {
388390
this.reuseChannel = reuseChannel;
389391
}
390392

391-
public void detachChannel() {
392-
this.channel = null;
393-
this.reuseChannel = false;
394-
}
395-
396393
public Channel channel() {
397394
return channel;
398395
}

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

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

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

193-
future.detachChannel();
193+
future.cancelTimeouts();
194194

195195
boolean keepAlive = future.isKeepAlive();
196196
if (expectOtherChunks && keepAlive)

0 commit comments

Comments
 (0)