src: Send out data in output buffer before HTTP2/SPDY session tear down

This commit is contained in:
Tatsuhiro Tsujikawa 2013-08-01 20:31:29 +09:00
parent 8cb92fc277
commit fec566aa23
5 changed files with 20 additions and 10 deletions

View File

@ -315,7 +315,8 @@ int Http2Handler::on_read()
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session_) == 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; rv = -1;
} }
} }
@ -331,7 +332,8 @@ int Http2Handler::on_write()
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session_) == 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; rv = -1;
} }
} }

View File

@ -508,7 +508,8 @@ struct HttpClient {
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session) == 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; rv = -1;
} }
} }
@ -524,7 +525,8 @@ struct HttpClient {
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session) == 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; rv = -1;
} }
} }

View File

@ -403,7 +403,8 @@ int Http2Upstream::on_read()
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session_) == 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)) { if(LOG_ENABLED(INFO)) {
ULOG(INFO, this) << "No more read/write for this SPDY session"; ULOG(INFO, this) << "No more read/write for this SPDY session";
} }
@ -428,7 +429,8 @@ int Http2Upstream::send()
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session_) == 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)) { if(LOG_ENABLED(INFO)) {
ULOG(INFO, this) << "No more read/write for this SPDY session"; ULOG(INFO, this) << "No more read/write for this SPDY session";
} }

View File

@ -1109,7 +1109,8 @@ int SpdySession::on_read()
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session_) == 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)) { if(LOG_ENABLED(INFO)) {
SSLOG(INFO, this) << "No more read/write for this session"; SSLOG(INFO, this) << "No more read/write for this session";
} }
@ -1133,7 +1134,8 @@ int SpdySession::send()
} }
if(rv == 0) { if(rv == 0) {
if(nghttp2_session_want_read(session_) == 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)) { if(LOG_ENABLED(INFO)) {
SSLOG(INFO, this) << "No more read/write for this session"; SSLOG(INFO, this) << "No more read/write for this session";
} }

View File

@ -407,7 +407,8 @@ int SpdyUpstream::on_read()
} }
if(rv == 0) { if(rv == 0) {
if(spdylay_session_want_read(session_) == 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)) { if(LOG_ENABLED(INFO)) {
ULOG(INFO, this) << "No more read/write for this SPDY session"; ULOG(INFO, this) << "No more read/write for this SPDY session";
} }
@ -432,7 +433,8 @@ int SpdyUpstream::send()
} }
if(rv == 0) { if(rv == 0) {
if(spdylay_session_want_read(session_) == 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)) { if(LOG_ENABLED(INFO)) {
ULOG(INFO, this) << "No more read/write for this SPDY session"; ULOG(INFO, this) << "No more read/write for this SPDY session";
} }