From 94125d6d035de818e5595e0f7f06cab59f18b1c7 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Fri, 14 Jun 2019 09:39:48 +0900 Subject: [PATCH] HTTP/2: cancel reading buffer when ATS received GOAWAY --- proxy/http2/Http2ClientSession.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc index 0bb86244ef2..e033ef536df 100644 --- a/proxy/http2/Http2ClientSession.cc +++ b/proxy/http2/Http2ClientSession.cc @@ -543,11 +543,13 @@ Http2ClientSession::state_process_frame_read(int event, VIO *vio, bool inside_fr } while (this->sm_reader->read_avail() >= (int64_t)HTTP2_FRAME_HEADER_LEN) { - // Cancel reading if there was an error - if (connection_state.tx_error_code.code != static_cast(Http2ErrorCode::HTTP2_ERROR_NO_ERROR)) { + // Cancel reading if there was an error or connection is closed + if (connection_state.tx_error_code.code != static_cast(Http2ErrorCode::HTTP2_ERROR_NO_ERROR) || + connection_state.is_state_closed()) { Http2SsnDebug("reading a frame has been canceled (%u)", connection_state.tx_error_code.code); break; } + // Return if there was an error Http2ErrorCode err; if (do_start_frame_read(err) < 0) {