From 29bc28a713463eb815524a91e03be95fe3aeedb1 Mon Sep 17 00:00:00 2001 From: shinrich Date: Wed, 10 Aug 2016 15:00:43 -0500 Subject: [PATCH] TS-4729: Fix dead assignment. --- proxy/http2/Http2Stream.cc | 24 +++++++++++++----------- proxy/http2/Http2Stream.h | 6 +++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc index 2fc73c469ac..07d767e5a74 100644 --- a/proxy/http2/Http2Stream.cc +++ b/proxy/http2/Http2Stream.cc @@ -490,7 +490,8 @@ Http2Stream::update_write_request(IOBufferReader *buf_reader, int64_t write_len, } } - bool is_done = (this->response_process_data()); + bool is_done = false; + this->response_process_data(is_done); if (total_added > 0 || is_done) { write_vio.ndone += total_added; int send_event = (write_vio.nbytes == write_vio.ndone || is_done) ? VC_EVENT_WRITE_COMPLETE : VC_EVENT_WRITE_READY; @@ -509,7 +510,10 @@ Http2Stream::update_write_request(IOBufferReader *buf_reader, int64_t write_len, parent->connection_state.send_headers_frame(this); // See if the response is chunked. Set up the dechunking logic if it is - is_done = this->response_initialize_data_handling(); + this->response_initialize_data_handling(is_done); + if (is_done) { + send_event = VC_EVENT_WRITE_COMPLETE; + } // If there is additional data, send it along in a data frame. Or if this was header only // make sure to send the end of stream @@ -639,10 +643,10 @@ check_continuation(Continuation *cont) return stream == NULL; } -bool -Http2Stream::response_initialize_data_handling() +void +Http2Stream::response_initialize_data_handling(bool &is_done) { - bool is_done = false; + is_done = false; const char *name = "transfer-encoding"; const char *value = "chunked"; int chunked_index = response_header.value_get_index(name, strlen(name), value, strlen(value)); @@ -657,16 +661,15 @@ Http2Stream::response_initialize_data_handling() this->response_reader = NULL; // Get things going if there is already data waiting if (this->chunked_handler.chunked_reader->is_read_avail_more_than(0)) { - is_done = response_process_data(); + response_process_data(is_done); } } - return is_done; } -bool -Http2Stream::response_process_data() +void +Http2Stream::response_process_data(bool &done) { - bool done = false; + done = false; if (chunked) { do { if (chunked_handler.state == ChunkedHandler::CHUNK_FLOW_CONTROL) { @@ -675,7 +678,6 @@ Http2Stream::response_process_data() done = this->chunked_handler.process_chunked_content(); } while (chunked_handler.state == ChunkedHandler::CHUNK_FLOW_CONTROL); } - return done; } bool diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 2a8eff80ea4..5d18b7eb893 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -215,9 +215,6 @@ class Http2Stream : public ProxyClientTransaction return chunked; } - bool response_initialize_data_handling(); - bool response_process_data(); - bool response_is_data_available() const; void release(IOBufferReader *r); virtual bool @@ -235,6 +232,9 @@ class Http2Stream : public ProxyClientTransaction void clear_io_events(); private: + void response_initialize_data_handling(bool &is_done); + void response_process_data(bool &is_done); + bool response_is_data_available() const; Event *send_tracked_event(Event *event, int send_event, VIO *vio); HTTPParser http_parser; ink_hrtime _start_time;