Response
This commit is contained in:
@@ -187,7 +187,9 @@ class ProtocolCodec implements CompletionHandler<Integer, ByteBuffer> {
|
||||
}
|
||||
channel.setReadBuffer(buffer.clear());
|
||||
context.executeDispatch(request, response);
|
||||
channel.readRegister(this);
|
||||
if (!response.readRegistered) {
|
||||
channel.readRegister(this);
|
||||
}
|
||||
}
|
||||
} else { // rs > 0
|
||||
channel.setReadBuffer(buffer);
|
||||
|
||||
@@ -46,6 +46,8 @@ public abstract class Response<C extends Context, R extends Request<C>> {
|
||||
|
||||
protected boolean inNonBlocking = true;
|
||||
|
||||
protected boolean readRegistered;
|
||||
|
||||
// 输出的结果对象
|
||||
protected Object output;
|
||||
|
||||
@@ -139,6 +141,7 @@ public abstract class Response<C extends Context, R extends Request<C>> {
|
||||
protected void prepare() {
|
||||
inited = true;
|
||||
inNonBlocking = true;
|
||||
readRegistered = false;
|
||||
request.prepare();
|
||||
}
|
||||
|
||||
@@ -348,6 +351,7 @@ public abstract class Response<C extends Context, R extends Request<C>> {
|
||||
this.responseConsumer.accept(this);
|
||||
if (!completed) {
|
||||
conn.readRegister(conn.protocolCodec);
|
||||
this.readRegistered = true;
|
||||
}
|
||||
} else {
|
||||
Supplier<Response> poolSupplier = this.responseSupplier;
|
||||
@@ -356,6 +360,7 @@ public abstract class Response<C extends Context, R extends Request<C>> {
|
||||
new ProtocolCodec(context, poolSupplier, poolConsumer, conn)
|
||||
.response(this)
|
||||
.run(null);
|
||||
this.readRegistered = true;
|
||||
}
|
||||
} else {
|
||||
this.responseConsumer.accept(this);
|
||||
|
||||
@@ -416,7 +416,7 @@ public class HttpRequest extends Request<HttpContext> {
|
||||
this.keepAlive = false;
|
||||
}
|
||||
// completed=true时ProtocolCodec会继续读下一个request
|
||||
this.completed = !this.boundary && !maybews && this.headerParsed;
|
||||
this.completed = !this.boundary && !maybews;
|
||||
this.readState = READ_STATE_BODY;
|
||||
}
|
||||
if (this.readState == READ_STATE_BODY) {
|
||||
|
||||
Reference in New Issue
Block a user