Skip to content

Commit c61679f

Browse files
author
Stephane Landelle
committed
NettyRequestSender.retry: future isn't null
1 parent c2d54eb commit c61679f

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

providers/netty/src/main/java/org/asynchttpclient/providers/netty/handler/Processor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
118118
if (future.isDone())
119119
channelManager.closeChannel(channel);
120120

121-
else if (!requestSender.retry(future, channel))
121+
else if (!requestSender.retry(future))
122122
requestSender.abort(future, REMOTELY_CLOSED_EXCEPTION);
123123
}
124124
}

providers/netty/src/main/java/org/asynchttpclient/providers/netty/request/NettyConnectListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void onFutureFailure(Channel channel, Throwable cause) {
129129
&& cause != null//
130130
&& (cause instanceof ClosedChannelException || future.getState() != NettyResponseFuture.STATE.NEW || StackTraceInspector.abortOnDisconnectException(cause))) {
131131

132-
if (requestSender.retry(future, channel)) {
132+
if (requestSender.retry(future)) {
133133
return;
134134
}
135135
}

providers/netty/src/main/java/org/asynchttpclient/providers/netty/request/NettyRequestSender.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,25 +403,19 @@ public void abort(NettyResponseFuture<?> future, Throwable t) {
403403
if (!future.isDone()) {
404404
LOGGER.debug("Aborting Future {}\n", future);
405405
LOGGER.debug(t.getMessage(), t);
406+
future.abort(t);
406407
}
407-
408-
future.abort(t);
409408
}
410409

411-
public boolean retry(NettyResponseFuture<?> future, Channel channel) {
410+
public boolean retry(NettyResponseFuture<?> future) {
412411

413412
if (isClosed())
414413
return false;
415414

416-
channelManager.removeAll(channel);
417-
418-
if (future == null) {
419-
Object attribute = Channels.getAttribute(channel);
420-
if (attribute instanceof NettyResponseFuture)
421-
future = (NettyResponseFuture<?>) attribute;
422-
}
415+
// FIXME what is this for???
416+
//channelManager.removeAll(channel);
423417

424-
if (future != null && future.canBeReplayed()) {
418+
if (future.canBeReplayed()) {
425419
future.setState(NettyResponseFuture.STATE.RECONNECTED);
426420
future.getAndSetStatusReceived(false);
427421

0 commit comments

Comments
 (0)