Skip to content

Commit 0d089b3

Browse files
author
Stephane Landelle
committed
Fix build
1 parent a6148d5 commit 0d089b3

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.io.IOException;
3636
import java.io.InputStream;
3737
import java.io.RandomAccessFile;
38+
import java.net.ConnectException;
3839
import java.net.InetSocketAddress;
3940
import java.net.URI;
4041
import java.util.Map;
@@ -66,7 +67,6 @@
6667
import org.asynchttpclient.providers.netty4.future.NettyResponseFuture;
6768
import org.asynchttpclient.providers.netty4.future.NettyResponseFutures;
6869
import org.asynchttpclient.providers.netty4.request.FeedableBodyGenerator.FeedListener;
69-
import org.asynchttpclient.providers.netty4.request.NettyConnectListener.Builder;
7070
import org.asynchttpclient.util.AsyncHttpProviderUtils;
7171
import org.asynchttpclient.util.ProxyUtils;
7272
import org.asynchttpclient.websocket.WebSocketUpgradeHandler;
@@ -121,7 +121,7 @@ public boolean retry(Channel channel, NettyResponseFuture<?> future) {
121121
}
122122
return success;
123123
}
124-
124+
125125
public boolean applyIoExceptionFiltersAndReplayRequest(ChannelHandlerContext ctx, NettyResponseFuture<?> future, IOException e) throws IOException {
126126

127127
boolean replayed = false;
@@ -224,26 +224,35 @@ private void performSyncConnect(ChannelFuture channelFuture, URI uri, boolean ac
224224

225225
try {
226226
channelFuture.syncUninterruptibly();
227-
cl.onFutureSuccess(channelFuture.channel());
228-
229227
} catch (Throwable t) {
230228
if (t.getCause() != null)
231229
t = t.getCause();
232230

233-
IOException ioe = null;
234-
if (t instanceof IOException)
235-
ioe = IOException.class.cast(t);
231+
ConnectException ce = null;
232+
if (t instanceof ConnectException)
233+
ce = ConnectException.class.cast(t);
236234
else
237-
ioe = new IOException(t.getMessage(), t);
235+
ce = new ConnectException(t.getMessage());
238236

239-
if (acquiredConnection)
237+
if (acquiredConnection) {
240238
channels.releaseFreeConnections();
239+
}
240+
channelFuture.cancel(false);
241+
channels.abort(cl.future(), ce);
242+
}
241243

242-
channels.abort(cl.future(), ioe);
244+
try {
245+
cl.operationComplete(channelFuture);
246+
} catch (Exception e) {
247+
if (acquiredConnection) {
248+
channels.releaseFreeConnections();
249+
}
250+
IOException ioe = new IOException(e.getMessage());
251+
ioe.initCause(e);
243252
try {
244253
asyncHandler.onThrowable(ioe);
245-
} catch (Throwable t2) {
246-
LOGGER.warn("asyncHandler.onThrowable()", t2);
254+
} catch (Throwable t) {
255+
LOGGER.warn("c.operationComplete()", t);
247256
}
248257
throw ioe;
249258
}

providers/netty4/src/main/java/org/asynchttpclient/providers/netty4/request/ProgressListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void operationComplete(ChannelProgressiveFuture cf) {
102102
@Override
103103
public void operationProgressed(ChannelProgressiveFuture f, long progress, long total) {
104104
future.touch();
105-
if (asyncHandler instanceof ProgressAsyncHandler) {
105+
if (!notifyHeaders && asyncHandler instanceof ProgressAsyncHandler) {
106106
long lastProgressValue = lastProgress.getAndSet(progress);
107107
ProgressAsyncHandler.class.cast(asyncHandler).onContentWriteProgress(progress - lastProgressValue, progress, total);
108108
}

0 commit comments

Comments
 (0)