Browse Source

Merge branch '5.3.x'

pull/29396/head
Arjen Poutsma 2 years ago
parent
commit
2ccfc7068e
  1. 13
      spring-web/src/main/java/org/springframework/http/codec/multipart/PartGenerator.java

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

@ -209,6 +209,7 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> { @@ -209,6 +209,7 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> {
void requestToken() {
if (upstream() != null &&
this.state.get().canRequest() &&
this.requestOutstanding.compareAndSet(false, true)) {
request(1);
}
@ -252,6 +253,13 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> { @@ -252,6 +253,13 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> {
default void error(Throwable throwable) {
}
/**
* Indicates whether the current state is ready to accept a new token.
*/
default boolean canRequest() {
return true;
}
/**
* Cleans up any state.
*/
@ -755,6 +763,11 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> { @@ -755,6 +763,11 @@ final class PartGenerator extends BaseSubscriber<MultipartParser.Token> {
}
}
@Override
public boolean canRequest() {
return false;
}
@Override
public void dispose() {
this.disposed = true;

Loading…
Cancel
Save