Skip to content

Commit 3d60974

Browse files
committed
Fix bug where full duplex requests are closed when wirecall is success
1 parent 700249e commit 3d60974

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/NettyRequestExecutor.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,13 @@ private void writeRequest(HttpRequest request) {
164164
.addListener(wireCall -> {
165165
// Done writing so remove the idle write timeout handler
166166
ChannelUtils.removeIfExists(channel.pipeline(), WriteTimeoutHandler.class);
167-
if (wireCall.isSuccess() && !context.executeRequest().fullDuplex()) {
168-
// Starting read so add the idle read timeout handler, removed when channel is released
169-
channel.pipeline().addFirst(new ReadTimeoutHandler(context.configuration().readTimeoutMillis(),
170-
TimeUnit.MILLISECONDS));
171-
channel.read();
172-
167+
if (wireCall.isSuccess()) {
168+
if (!context.executeRequest().fullDuplex()) {
169+
// Starting read so add the idle read timeout handler, removed when channel is released
170+
channel.pipeline().addFirst(new ReadTimeoutHandler(context.configuration().readTimeoutMillis(),
171+
TimeUnit.MILLISECONDS));
172+
channel.read();
173+
}
173174
} else {
174175
// TODO: Are there cases where we can keep the channel open?
175176
closeAndRelease(channel);

0 commit comments

Comments
 (0)