This is an automated email from the ASF dual-hosted git repository.
maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0ae31786b2 quic: Cancel events when streams get closed (#11074)
0ae31786b2 is described below
commit 0ae31786b2427e1bc9c4b7f7e3f9c9783474f0d6
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Wed Feb 14 09:16:15 2024 -0700
quic: Cancel events when streams get closed (#11074)
---
include/iocore/net/quic/QUICStreamVCAdapter.h | 1 +
src/iocore/net/quic/QUICStreamVCAdapter.cc | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/include/iocore/net/quic/QUICStreamVCAdapter.h
b/include/iocore/net/quic/QUICStreamVCAdapter.h
index 846cf9a86d..0e3b296e20 100644
--- a/include/iocore/net/quic/QUICStreamVCAdapter.h
+++ b/include/iocore/net/quic/QUICStreamVCAdapter.h
@@ -61,6 +61,7 @@ protected:
Event *_read_event = nullptr;
Event *_write_event = nullptr;
+ Event *_eos_event = nullptr;
};
class QUICStreamVCAdapter::IOInfo
diff --git a/src/iocore/net/quic/QUICStreamVCAdapter.cc
b/src/iocore/net/quic/QUICStreamVCAdapter.cc
index b423531cd7..b427410df1 100644
--- a/src/iocore/net/quic/QUICStreamVCAdapter.cc
+++ b/src/iocore/net/quic/QUICStreamVCAdapter.cc
@@ -40,6 +40,11 @@ QUICStreamVCAdapter::~QUICStreamVCAdapter()
this->_write_event->cancel();
this->_write_event = nullptr;
}
+
+ if (this->_eos_event) {
+ this->_eos_event->cancel();
+ this->_eos_event = nullptr;
+ }
}
int64_t
@@ -146,7 +151,9 @@ QUICStreamVCAdapter::encourge_read()
}
int event = this->_read_vio.nbytes == INT64_MAX ? VC_EVENT_READ_READY :
VC_EVENT_READ_COMPLETE;
- this_ethread()->schedule_imm(this->_read_vio.cont, event,
&this->_read_vio);
+ if (!(this->_read_event && this->_read_event->callback_event == event)) {
+ this->_read_event = this_ethread()->schedule_imm(this->_read_vio.cont,
event, &this->_read_vio);
+ }
}
}
@@ -164,7 +171,9 @@ QUICStreamVCAdapter::encourge_write()
}
int event = this->_write_vio.ntodo() ? VC_EVENT_WRITE_READY :
VC_EVENT_WRITE_COMPLETE;
- this_ethread()->schedule_imm(this->_write_vio.cont, event,
&this->_write_vio);
+ if (!(this->_write_event && this->_write_event->callback_event == event)) {
+ this->_write_event = this_ethread()->schedule_imm(this->_write_vio.cont,
event, &this->_write_vio);
+ }
}
}
@@ -184,7 +193,9 @@ QUICStreamVCAdapter::notify_eos()
if (lock.is_locked()) {
this->_read_vio.cont->handleEvent(event, &this->_read_vio);
} else {
- this_ethread()->schedule_imm(this->_read_vio.cont, event,
&this->_read_vio);
+ if (!(this->_eos_event && this->_eos_event->callback_event == event)) {
+ this->_eos_event = this_ethread()->schedule_imm(this->_read_vio.cont,
event, &this->_read_vio);
+ }
}
}
}