This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 1013eb3 Track scheduled events to (read|write)_vio.cont from
Http2Stream
1013eb3 is described below
commit 1013eb3b1486447a93588fd876ae80fc6deadea8
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 da681d3..8bdb163 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -78,14 +78,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;
@@ -98,7 +104,10 @@ Http2Stream::main_event_handler(int event, void *edata)
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);
}
}
} else {
@@ -114,7 +123,10 @@ 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 {
@@ -916,6 +928,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 a005a62..8b747bd 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -318,8 +318,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;