Skip to content

Commit 0742160

Browse files
violetaggrstoyanchev
authored andcommitted
Propagate the cancel signal to the downstream
1 parent 03fb343 commit 0742160

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spring-web/src/main/java/org/springframework/http/server/reactive/ChannelSendOperator.java

+7
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ private class WriteCompletionBarrier implements CoreSubscriber<Void>, Subscripti
337337

338338
private final WriteBarrier writeBarrier;
339339

340+
private Subscription subscription;
341+
340342

341343
public WriteCompletionBarrier(CoreSubscriber<? super Void> subscriber, WriteBarrier writeBarrier) {
342344
this.completionSubscriber = subscriber;
@@ -356,6 +358,7 @@ public void connect() {
356358

357359
@Override
358360
public void onSubscribe(Subscription subscription) {
361+
this.subscription = subscription;
359362
subscription.request(Long.MAX_VALUE);
360363
}
361364

@@ -387,6 +390,10 @@ public void request(long n) {
387390
@Override
388391
public void cancel() {
389392
this.writeBarrier.cancel();
393+
Subscription subscription = this.subscription;
394+
if (subscription != null) {
395+
subscription.cancel();
396+
}
390397
}
391398
}
392399

0 commit comments

Comments
 (0)