From 1e1a4974e0d8fe45f7f598ada66dcb2e89c2364b Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Wed, 14 Sep 2016 12:15:02 +0900 Subject: [PATCH] TS-4833: Check stream is not closed when restart it --- proxy/http2/Http2ConnectionState.cc | 4 ++-- proxy/http2/Http2Stream.h | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 7f2b8bb54f0..e1fa654b067 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -658,7 +658,7 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame) stream->client_rwnd += size; ssize_t wnd = min(cstate.client_rwnd, stream->client_rwnd); - if (stream->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && wnd > 0) { + if (!stream->is_closed() && stream->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && wnd > 0) { stream->send_response_body(); } } @@ -948,7 +948,7 @@ Http2ConnectionState::restart_streams() while (s) { Http2Stream *next = s->link.next; - if (s->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && min(this->client_rwnd, s->client_rwnd) > 0) { + if (!s->is_closed() && s->get_state() == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && min(this->client_rwnd, s->client_rwnd) > 0) { s->send_response_body(); } s = next; diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 24c8c402d68..6aa2dec8742 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -240,12 +240,18 @@ class Http2Stream : public ProxyClientTransaction void clear_timers(); void clear_io_events(); bool - is_client_state_writeable() + is_client_state_writeable() const { return _state == HTTP2_STREAM_STATE_OPEN || _state == HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE || HTTP2_STREAM_STATE_RESERVED_LOCAL; } + bool + is_closed() const + { + return closed; + } + private: void response_initialize_data_handling(bool &is_done); void response_process_data(bool &is_done);