diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 048bc493..4ed54289 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -315,7 +315,8 @@ int Http2Handler::on_read() } if(rv == 0) { if(nghttp2_session_want_read(session_) == 0 && - nghttp2_session_want_write(session_) == 0) { + nghttp2_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(bev_)) == 0) { rv = -1; } } @@ -331,7 +332,8 @@ int Http2Handler::on_write() } if(rv == 0) { if(nghttp2_session_want_read(session_) == 0 && - nghttp2_session_want_write(session_) == 0) { + nghttp2_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(bev_)) == 0) { rv = -1; } } diff --git a/src/nghttp.cc b/src/nghttp.cc index 93e312e9..6fbc8a44 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -508,7 +508,8 @@ struct HttpClient { } if(rv == 0) { if(nghttp2_session_want_read(session) == 0 && - nghttp2_session_want_write(session) == 0) { + nghttp2_session_want_write(session) == 0 && + evbuffer_get_length(bufferevent_get_output(bev)) == 0) { rv = -1; } } @@ -524,7 +525,8 @@ struct HttpClient { } if(rv == 0) { if(nghttp2_session_want_read(session) == 0 && - nghttp2_session_want_write(session) == 0) { + nghttp2_session_want_write(session) == 0 && + evbuffer_get_length(bufferevent_get_output(bev)) == 0) { rv = -1; } } diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index 44554e98..a0fa6a42 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -403,7 +403,8 @@ int Http2Upstream::on_read() } if(rv == 0) { if(nghttp2_session_want_read(session_) == 0 && - nghttp2_session_want_write(session_) == 0) { + nghttp2_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(handler_->get_bev())) == 0) { if(LOG_ENABLED(INFO)) { ULOG(INFO, this) << "No more read/write for this SPDY session"; } @@ -428,7 +429,8 @@ int Http2Upstream::send() } if(rv == 0) { if(nghttp2_session_want_read(session_) == 0 && - nghttp2_session_want_write(session_) == 0) { + nghttp2_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(handler_->get_bev())) == 0) { if(LOG_ENABLED(INFO)) { ULOG(INFO, this) << "No more read/write for this SPDY session"; } diff --git a/src/shrpx_spdy_session.cc b/src/shrpx_spdy_session.cc index 0f0f0110..a07d1f3c 100644 --- a/src/shrpx_spdy_session.cc +++ b/src/shrpx_spdy_session.cc @@ -1109,7 +1109,8 @@ int SpdySession::on_read() } if(rv == 0) { if(nghttp2_session_want_read(session_) == 0 && - nghttp2_session_want_write(session_) == 0) { + nghttp2_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(bev_)) == 0) { if(LOG_ENABLED(INFO)) { SSLOG(INFO, this) << "No more read/write for this session"; } @@ -1133,7 +1134,8 @@ int SpdySession::send() } if(rv == 0) { if(nghttp2_session_want_read(session_) == 0 && - nghttp2_session_want_write(session_) == 0) { + nghttp2_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(bev_)) == 0) { if(LOG_ENABLED(INFO)) { SSLOG(INFO, this) << "No more read/write for this session"; } diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index 1cb76314..e860523a 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -407,7 +407,8 @@ int SpdyUpstream::on_read() } if(rv == 0) { if(spdylay_session_want_read(session_) == 0 && - spdylay_session_want_write(session_) == 0) { + spdylay_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(handler_->get_bev())) == 0) { if(LOG_ENABLED(INFO)) { ULOG(INFO, this) << "No more read/write for this SPDY session"; } @@ -432,7 +433,8 @@ int SpdyUpstream::send() } if(rv == 0) { if(spdylay_session_want_read(session_) == 0 && - spdylay_session_want_write(session_) == 0) { + spdylay_session_want_write(session_) == 0 && + evbuffer_get_length(bufferevent_get_output(handler_->get_bev())) == 0) { if(LOG_ENABLED(INFO)) { ULOG(INFO, this) << "No more read/write for this SPDY session"; }