parent
0754833b37
commit
551505bd93
|
@ -320,7 +320,8 @@ public abstract class AbstractListenerReadPublisher<T> implements Publisher<T> {
|
||||||
<T> void onDataAvailable(AbstractListenerReadPublisher<T> publisher) {
|
<T> void onDataAvailable(AbstractListenerReadPublisher<T> publisher) {
|
||||||
if (publisher.changeState(this, READING)) {
|
if (publisher.changeState(this, READING)) {
|
||||||
try {
|
try {
|
||||||
boolean demandAvailable = publisher.readAndPublish();
|
boolean demandAvailable = publisher.
|
||||||
|
readAndPublish();
|
||||||
if (demandAvailable) {
|
if (demandAvailable) {
|
||||||
publisher.changeToDemandState(READING);
|
publisher.changeToDemandState(READING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,8 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
|
||||||
/**
|
/**
|
||||||
* Read from the request body InputStream and return a DataBuffer.
|
* Read from the request body InputStream and return a DataBuffer.
|
||||||
* Invoked only when {@link ServletInputStream#isReady()} returns "true".
|
* Invoked only when {@link ServletInputStream#isReady()} returns "true".
|
||||||
|
* @return a DataBuffer with data read, or {@link #EOF_BUFFER} if the input
|
||||||
|
* stream returned -1, or null if 0 bytes were read.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
DataBuffer readFromInputStream() throws IOException {
|
DataBuffer readFromInputStream() throws IOException {
|
||||||
|
@ -211,7 +213,8 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
|
||||||
dataBuffer.write(this.buffer, 0, read);
|
dataBuffer.write(this.buffer, 0, read);
|
||||||
return dataBuffer;
|
return dataBuffer;
|
||||||
}
|
}
|
||||||
else if (read == -1) {
|
|
||||||
|
if (read == -1) {
|
||||||
return EOF_BUFFER;
|
return EOF_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,13 +276,12 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
|
||||||
protected DataBuffer read() throws IOException {
|
protected DataBuffer read() throws IOException {
|
||||||
if (this.inputStream.isReady()) {
|
if (this.inputStream.isReady()) {
|
||||||
DataBuffer dataBuffer = readFromInputStream();
|
DataBuffer dataBuffer = readFromInputStream();
|
||||||
if (dataBuffer != EOF_BUFFER) {
|
if (dataBuffer == EOF_BUFFER) {
|
||||||
return dataBuffer;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// No need to wait for container callback...
|
// No need to wait for container callback...
|
||||||
onAllDataRead();
|
onAllDataRead();
|
||||||
|
dataBuffer = null;
|
||||||
}
|
}
|
||||||
|
return dataBuffer;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue