nghttpx: Process buffered data first without reading additional data

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-06 22:48:17 +09:00
parent b9174b828e
commit d1391f1db7
2 changed files with 16 additions and 2 deletions

View File

@ -97,9 +97,13 @@ int ClientHandler::read_clear() {
ev_timer_again(loop_, &rt_);
for (;;) {
// we should process buffered data first before we read EOF.
if (rb_.rleft() && on_read() != 0) {
return -1;
}
if (rb_.rleft()) {
return 0;
}
rb_.reset();
struct iovec iov[2];
auto iovcnt = rb_.wiovec(iov);
@ -222,10 +226,13 @@ int ClientHandler::read_tls() {
ev_timer_again(loop_, &rt_);
for (;;) {
// we should process buffered data first before we read EOF.
if (rb_.rleft() && on_read() != 0) {
return -1;
}
if (rb_.rleft()) {
return 0;
}
rb_.reset();
struct iovec iov[2];
auto iovcnt = rb_.wiovec(iov);

View File

@ -1537,9 +1537,13 @@ int Http2Session::read_clear() {
ev_timer_again(loop_, &rt_);
for (;;) {
// we should process buffered data first before we read EOF.
if (rb_.rleft() && on_read() != 0) {
return -1;
}
if (rb_.rleft()) {
return 0;
}
rb_.reset();
struct iovec iov[2];
auto iovcnt = rb_.wiovec(iov);
@ -1661,10 +1665,13 @@ int Http2Session::read_tls() {
ev_timer_again(loop_, &rt_);
for (;;) {
// we should process buffered data first before we read EOF.
if (rb_.rleft() && on_read() != 0) {
return -1;
}
if (rb_.rleft()) {
return 0;
}
rb_.reset();
struct iovec iov[2];
auto iovcnt = rb_.wiovec(iov);