Skip to content

Commit b794f84

Browse files
committed
Add fix for FullResponseContentPublisher
Flip to done before signaling onError/onComplete to prevent infinite recursion if the subscription is called again synchronously from within those methods
1 parent 8b61988 commit b794f84

File tree

1 file changed

+2
-2
lines changed
  • http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,14 @@ public void subscribe(Subscriber<? super ByteBuffer> subscriber) {
245245
@Override
246246
public void request(long l) {
247247
if (l <= 0 && running) {
248-
subscriber.onError(new IllegalArgumentException("Demand must be positive!"));
249248
running = false;
249+
subscriber.onError(new IllegalArgumentException("Demand must be positive!"));
250250
} else if (running) {
251+
running = false;
251252
subscriber.onNext(fullContent);
252253
subscriber.onComplete();
253254
channelContext.channel().attr(ChannelAttributeKeys.SUBSCRIBER_KEY)
254255
.set(subscriber);
255-
running = false;
256256
}
257257
}
258258

0 commit comments

Comments
 (0)