nghttpx: Read from backend eagerly in all upstreams
This commit is contained in:
parent
426fbda799
commit
5a6d6ccbd4
|
@ -1006,7 +1006,8 @@ ssize_t downstream_data_read_callback(nghttp2_session *session,
|
||||||
|
|
||||||
auto dconn = downstream->get_downstream_connection();
|
auto dconn = downstream->get_downstream_connection();
|
||||||
|
|
||||||
if (body->rleft() == 0 && dconn) {
|
if (body->rleft() == 0 && dconn &&
|
||||||
|
downstream->get_response_state() != Downstream::MSG_COMPLETE) {
|
||||||
// Try to read more if buffer is empty. This will help small
|
// Try to read more if buffer is empty. This will help small
|
||||||
// buffer and make priority handling a bit better.
|
// buffer and make priority handling a bit better.
|
||||||
if (upstream->downstream_read(dconn) != 0) {
|
if (upstream->downstream_read(dconn) != 0) {
|
||||||
|
|
|
@ -391,7 +391,14 @@ int HttpsUpstream::on_write() {
|
||||||
if (!downstream) {
|
if (!downstream) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
auto dconn = downstream->get_downstream_connection();
|
||||||
auto wb = handler_->get_wb();
|
auto wb = handler_->get_wb();
|
||||||
|
if (wb->rleft() == 0 && dconn &&
|
||||||
|
downstream->get_response_state() != Downstream::MSG_COMPLETE) {
|
||||||
|
if (downstream_read(dconn) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
auto iovcnt = wb->wiovec(iov);
|
auto iovcnt = wb->wiovec(iov);
|
||||||
if (iovcnt == 0) {
|
if (iovcnt == 0) {
|
||||||
|
|
|
@ -704,6 +704,17 @@ ssize_t spdy_data_read_callback(spdylay_session *session, int32_t stream_id,
|
||||||
auto body = downstream->get_response_buf();
|
auto body = downstream->get_response_buf();
|
||||||
assert(body);
|
assert(body);
|
||||||
|
|
||||||
|
auto dconn = downstream->get_downstream_connection();
|
||||||
|
|
||||||
|
if (body->rleft() == 0 && dconn &&
|
||||||
|
downstream->get_response_state() != Downstream::MSG_COMPLETE) {
|
||||||
|
// Try to read more if buffer is empty. This will help small
|
||||||
|
// buffer and make priority handling a bit better.
|
||||||
|
if (upstream->downstream_read(dconn) != 0) {
|
||||||
|
return SPDYLAY_ERR_CALLBACK_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto nread = body->remove(buf, length);
|
auto nread = body->remove(buf, length);
|
||||||
auto body_empty = body->rleft() == 0;
|
auto body_empty = body->rleft() == 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue