You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jv...@apache.org on 2026/10/10 19:36:18 UTC
(trafficserver) branch master updated: Pass nullptr to net `mainEvent` callback (#13824)
This is an automated email from the ASF dual-hosted git repository.
JosiahWI 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 a67927e990 Pass nullptr to net `mainEvent` callback (#13824)
a67927e990 is described below
commit a67927e9905d7c5544055ed3b56b11212f13d8e9
Author: JosiahWI <41...@users.noreply.github.com>
AuthorDate: Sat Oct 10 14:36:12 2026 -0500
Pass nullptr to net `mainEvent` callback (#13824)
Since 974e8e3 (in 2015), it is no longer necessary for `mainEvent` to
inspect its `Event`, so callers no longer need to build a dummy `Event`.
---
src/iocore/net/NetHandler.cc | 7 ++-----
src/iocore/net/UnixNetVConnection.cc | 14 ++++++--------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/iocore/net/NetHandler.cc b/src/iocore/net/NetHandler.cc
index 334fb2800e..10157d2933 100644
--- a/src/iocore/net/NetHandler.cc
+++ b/src/iocore/net/NetHandler.cc
@@ -505,15 +505,12 @@ NetHandler::_close_ne(NetEvent *ne, ink_hrtime now, int &handle_event, int &clos
++closed;
} else {
ne->next_inactivity_timeout_at = now;
- // create a dummy event
- Event event;
- event.ethread = this_ethread();
if (ne->inactivity_timeout_in && ne->next_inactivity_timeout_at <= now) {
- if (ne->callback(VC_EVENT_INACTIVITY_TIMEOUT, &event) == EVENT_DONE) {
+ if (ne->callback(VC_EVENT_INACTIVITY_TIMEOUT) == EVENT_DONE) {
++handle_event;
}
} else if (ne->active_timeout_in && ne->next_activity_timeout_at <= now) {
- if (ne->callback(VC_EVENT_ACTIVE_TIMEOUT, &event) == EVENT_DONE) {
+ if (ne->callback(VC_EVENT_ACTIVE_TIMEOUT) == EVENT_DONE) {
++handle_event;
}
}
diff --git a/src/iocore/net/UnixNetVConnection.cc b/src/iocore/net/UnixNetVConnection.cc
index cae91299e3..f06b85e31e 100644
--- a/src/iocore/net/UnixNetVConnection.cc
+++ b/src/iocore/net/UnixNetVConnection.cc
@@ -1010,14 +1010,16 @@ UnixNetVConnection::acceptEvent(int /* event ATS_UNUSED */, Event *e)
// and for active and inactivity timeouts.
//
int
-UnixNetVConnection::mainEvent(int event, Event *e)
+UnixNetVConnection::mainEvent(int event, Event * /* e ATS_UNUSED */)
{
ink_assert(event == VC_EVENT_ACTIVE_TIMEOUT || event == VC_EVENT_INACTIVITY_TIMEOUT);
ink_assert(thread == this_ethread());
- MUTEX_TRY_LOCK(hlock, get_NetHandler(thread)->mutex, e->ethread);
- MUTEX_TRY_LOCK(rlock, read.vio.mutex ? read.vio.mutex : e->ethread->mutex, e->ethread);
- MUTEX_TRY_LOCK(wlock, write.vio.mutex ? write.vio.mutex : e->ethread->mutex, e->ethread);
+ EThread *t = this_ethread();
+
+ MUTEX_TRY_LOCK(hlock, get_NetHandler(thread)->mutex, t);
+ MUTEX_TRY_LOCK(rlock, read.vio.mutex ? read.vio.mutex : t->mutex, t);
+ MUTEX_TRY_LOCK(wlock, write.vio.mutex ? write.vio.mutex : t->mutex, t);
if (!hlock.is_locked() || !rlock.is_locked() || !wlock.is_locked() ||
(read.vio.mutex && rlock.get_mutex() != read.vio.mutex.get()) ||
@@ -1025,10 +1027,6 @@ UnixNetVConnection::mainEvent(int event, Event *e)
return EVENT_CONT;
}
- if (e->cancelled) {
- return EVENT_DONE;
- }
-
int signal_event;
Continuation *reader_cont = nullptr;
Continuation *writer_cont = nullptr;