This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 8.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 3c213fc8e270d9f343977600e4c4182d7afa86ff Author: Masaori Koshiba <[email protected]> AuthorDate: Fri Sep 13 09:16:33 2019 +0900 Track scheduled events to (read|write)_vio.cont from Http2Stream (cherry picked from commit 9bd2fd6f0264bfe2176895531f8348fea20f84fa) --- proxy/http2/Http2Stream.cc | 30 ++++++++++++++++++++++++++---- proxy/http2/Http2Stream.h | 6 ++++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc index 2e11782..74d910f 100644 --- a/proxy/http2/Http2Stream.cc +++ b/proxy/http2/Http2Stream.cc @@ -103,14 +103,20 @@ Http2Stream::main_event_handler(int event, void *edata) if (lock.is_locked()) { read_vio.cont->handleEvent(event, &read_vio); } else { - this_ethread()->schedule_imm(read_vio.cont, event, &read_vio); + if (this->_read_vio_event) { + this->_read_vio_event->cancel(); + } + this->_read_vio_event = this_ethread()->schedule_imm(read_vio.cont, event, &read_vio); } } else if (current_reader && write_vio.ntodo() > 0) { MUTEX_TRY_LOCK(lock, write_vio.mutex, this_ethread()); if (lock.is_locked()) { write_vio.cont->handleEvent(event, &write_vio); } else { - this_ethread()->schedule_imm(write_vio.cont, event, &write_vio); + if (this->_write_vio_event) { + this->_write_vio_event->cancel(); + } + this->_write_vio_event = this_ethread()->schedule_imm(write_vio.cont, event, &write_vio); } } break; @@ -123,7 +129,10 @@ Http2Stream::main_event_handler(int event, void *edata) if (lock.is_locked() && write_vio.cont && this->current_reader) { write_vio.cont->handleEvent(event, &write_vio); } else { - this_ethread()->schedule_imm(write_vio.cont, event, &write_vio); + if (this->_write_vio_event) { + this->_write_vio_event->cancel(); + } + this->_write_vio_event = this_ethread()->schedule_imm(write_vio.cont, event, &write_vio); } } } else { @@ -139,7 +148,10 @@ Http2Stream::main_event_handler(int event, void *edata) if (lock.is_locked() && read_vio.cont && this->current_reader) { read_vio.cont->handleEvent(event, &read_vio); } else { - this_ethread()->schedule_imm(read_vio.cont, event, &read_vio); + if (this->_read_vio_event) { + this->_read_vio_event->cancel(); + } + this->_read_vio_event = this_ethread()->schedule_imm(read_vio.cont, event, &read_vio); } } } else { @@ -885,6 +897,16 @@ Http2Stream::clear_io_events() buffer_full_write_event->cancel(); buffer_full_write_event = nullptr; } + + if (this->_read_vio_event) { + this->_read_vio_event->cancel(); + this->_read_vio_event = nullptr; + } + + if (this->_write_vio_event) { + this->_write_vio_event->cancel(); + this->_write_vio_event = nullptr; + } } void diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 4630190..261f44c 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -211,8 +211,10 @@ private: ink_hrtime inactive_timeout_at = 0; Event *inactive_event = nullptr; - Event *read_event = nullptr; - Event *write_event = nullptr; + Event *read_event = nullptr; + Event *write_event = nullptr; + Event *_read_vio_event = nullptr; + Event *_write_vio_event = nullptr; }; extern ClassAllocator<Http2Stream> http2StreamAllocator;
