From 6f5e1662c6eab46077ccee23673513f1afeee2c9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 19 Jan 2014 14:42:42 +0900 Subject: [PATCH] nghttpx: Handle error from Downstream::resume_read() --- src/shrpx_http2_downstream_connection.cc | 4 ++-- src/shrpx_http2_upstream.cc | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shrpx_http2_downstream_connection.cc b/src/shrpx_http2_downstream_connection.cc index 76830862..857fa6be 100644 --- a/src/shrpx_http2_downstream_connection.cc +++ b/src/shrpx_http2_downstream_connection.cc @@ -192,9 +192,9 @@ ssize_t http2_data_read_callback(nghttp2_session *session, // This is important because it will handle flow control // stuff. if(downstream->get_upstream()->resume_read(SHRPX_NO_BUFFER, - downstream) == -1) { + downstream) != 0) { // 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() // may delete downstream which will delete dconn. diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index ba972998..7e0a4c57 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -906,7 +906,9 @@ ssize_t downstream_data_read_callback(nghttp2_session *session, // of RTT. if(*eof != 1 && 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) { return NGHTTP2_ERR_DEFERRED;