nghttpx: Handle error from Downstream::resume_read()

This commit is contained in:
Tatsuhiro Tsujikawa 2014-01-19 14:42:42 +09:00
parent becc206ba9
commit 6f5e1662c6
2 changed files with 5 additions and 3 deletions

View File

@ -192,9 +192,9 @@ ssize_t http2_data_read_callback(nghttp2_session *session,
// This is important because it will handle flow control // This is important because it will handle flow control
// stuff. // stuff.
if(downstream->get_upstream()->resume_read(SHRPX_NO_BUFFER, if(downstream->get_upstream()->resume_read(SHRPX_NO_BUFFER,
downstream) == -1) { downstream) != 0) {
// In this case, downstream may be deleted. // In this case, downstream may be deleted.
return NGHTTP2_ERR_DEFERRED; return NGHTTP2_ERR_CALLBACK_FAILURE;
} }
// Check dconn is still alive because Upstream::resume_read() // Check dconn is still alive because Upstream::resume_read()
// may delete downstream which will delete dconn. // may delete downstream which will delete dconn.

View File

@ -906,7 +906,9 @@ ssize_t downstream_data_read_callback(nghttp2_session *session,
// of RTT. // of RTT.
if(*eof != 1 && if(*eof != 1 &&
evbuffer_get_length(body) < SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER_THRES) { evbuffer_get_length(body) < SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER_THRES) {
downstream->resume_read(SHRPX_NO_BUFFER); if(downstream->resume_read(SHRPX_NO_BUFFER) != 0) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
} }
if(nread == 0 && *eof != 1) { if(nread == 0 && *eof != 1) {
return NGHTTP2_ERR_DEFERRED; return NGHTTP2_ERR_DEFERRED;