Skip to content

Commit 1786d05

Browse files
author
Stephane Landelle
committed
future can be null, directly pass the asyncHandler
1 parent 8e02a3a commit 1786d05

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private <T> ListenableFuture<T> sendRequestWithCertainForceConnect(//
129129

130130
NettyResponseFuture<T> newFuture = newNettyRequestAndResponseFuture(request, asyncHandler, future, uri, proxyServer, forceConnect);
131131

132-
Channel channel = getCachedChannel(future, uri, request.getConnectionPoolKeyStrategy(), proxyServer);
132+
Channel channel = getCachedChannel(future, uri, request.getConnectionPoolKeyStrategy(), proxyServer, asyncHandler);
133133

134134
if (Channels.isChannelValid(channel))
135135
return sendRequestWithCachedChannel(request, uri, proxyServer, newFuture, asyncHandler, channel);
@@ -153,7 +153,7 @@ private <T> ListenableFuture<T> sendRequestThroughSslProxy(//
153153

154154
NettyResponseFuture<T> newFuture = null;
155155
for (int i = 0; i < 3; i++) {
156-
Channel channel = getCachedChannel(future, uri, request.getConnectionPoolKeyStrategy(), proxyServer);
156+
Channel channel = getCachedChannel(future, uri, request.getConnectionPoolKeyStrategy(), proxyServer, asyncHandler);
157157
if (Channels.isChannelValid(channel))
158158
if (newFuture == null)
159159
newFuture = newNettyRequestAndResponseFuture(request, asyncHandler, future, uri, proxyServer, false);
@@ -184,12 +184,12 @@ private <T> NettyResponseFuture<T> newNettyRequestAndResponseFuture(final Reques
184184
}
185185
}
186186

187-
private Channel getCachedChannel(NettyResponseFuture<?> future, UriComponents uri, ConnectionPoolKeyStrategy poolKeyGen, ProxyServer proxyServer) {
187+
private Channel getCachedChannel(NettyResponseFuture<?> future, UriComponents uri, ConnectionPoolKeyStrategy poolKeyGen, ProxyServer proxyServer, AsyncHandler<?> asyncHandler) {
188188

189189
if (future != null && future.reuseChannel() && Channels.isChannelValid(future.channel()))
190190
return future.channel();
191191
else
192-
return pollAndVerifyCachedChannel(uri, proxyServer, poolKeyGen, future.getAsyncHandler());
192+
return pollAndVerifyCachedChannel(uri, proxyServer, poolKeyGen, asyncHandler);
193193
}
194194

195195
private <T> ListenableFuture<T> sendRequestWithCachedChannel(Request request, UriComponents uri, ProxyServer proxy, NettyResponseFuture<T> future,

0 commit comments

Comments
 (0)