Skip to content

Commit 2ccfc70

Browse files
committed
Merge branch '5.3.x'
2 parents c21bd66 + 4632985 commit 2ccfc70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spring-web/src/main/java/org/springframework/http/codec/multipart/PartGenerator.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ void emitError(Throwable t) {
209209

210210
void requestToken() {
211211
if (upstream() != null &&
212+
this.state.get().canRequest() &&
212213
this.requestOutstanding.compareAndSet(false, true)) {
213214
request(1);
214215
}
@@ -252,6 +253,13 @@ private interface State {
252253
default void error(Throwable throwable) {
253254
}
254255

256+
/**
257+
* Indicates whether the current state is ready to accept a new token.
258+
*/
259+
default boolean canRequest() {
260+
return true;
261+
}
262+
255263
/**
256264
* Cleans up any state.
257265
*/
@@ -755,6 +763,11 @@ private Mono<Void> writeInternal(DataBuffer dataBuffer) {
755763
}
756764
}
757765

766+
@Override
767+
public boolean canRequest() {
768+
return false;
769+
}
770+
758771
@Override
759772
public void dispose() {
760773
this.disposed = true;

0 commit comments

Comments
 (0)