This is an automated email from the ASF dual-hosted git repository.
masaori 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 1cea215472 Add nullptr guards in ActivityCop functions (#11266)
1cea215472 is described below
commit 1cea2154722f302dde35668e1766586a8d9c717e
Author: Masaori Koshiba <[email protected]>
AuthorDate: Tue Apr 23 07:20:52 2024 +0900
Add nullptr guards in ActivityCop functions (#11266)
* Add nullptr guards in ActivityCop functions
* Set nullptr after canceling event
---
include/iocore/net/NetTimeout.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/iocore/net/NetTimeout.h b/include/iocore/net/NetTimeout.h
index b10570994b..8cef2a804a 100644
--- a/include/iocore/net/NetTimeout.h
+++ b/include/iocore/net/NetTimeout.h
@@ -219,14 +219,19 @@ template <class T, class List>
inline void
ActivityCop<T, List>::start()
{
- _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+ if (_event == nullptr) {
+ _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+ }
}
template <class T, class List>
inline void
ActivityCop<T, List>::stop()
{
- _event->cancel();
+ if (_event != nullptr) {
+ _event->cancel();
+ _event = nullptr;
+ }
}
template <class T, class List>