This is an automated email from the ASF dual-hosted git repository.
dmeden 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 3a2177a097 NetHandler - Use the right type to hold additional_accepts
config value. (#11659)
3a2177a097 is described below
commit 3a2177a09748c62b63098979cdd822d3e7eb765e
Author: Damian Meden <[email protected]>
AuthorDate: Tue Aug 20 10:53:51 2024 +0200
NetHandler - Use the right type to hold additional_accepts config value.
(#11659)
Changed from unsigned to signed as this is what's expected. This PR also
makes sure the records validity check passes.
---
include/iocore/net/NetHandler.h | 2 +-
src/iocore/net/NetHandler.cc | 19 +++++++++++--------
src/records/RecordsConfig.cc | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/iocore/net/NetHandler.h b/include/iocore/net/NetHandler.h
index a78f029c6f..2c84f4e865 100644
--- a/include/iocore/net/NetHandler.h
+++ b/include/iocore/net/NetHandler.h
@@ -236,7 +236,7 @@ private:
// TS_EVENT_MGMT_UPDATE event like with the Config settings above because
// accept threads are not always on a standard NET thread with a NetHandler
// that has TS_EVENT_MGMT_UPDATE handling logic.
- static std::atomic<uint32_t> additional_accepts;
+ static std::atomic<int32_t> additional_accepts;
static std::atomic<uint32_t> per_client_max_connections_in;
void _close_ne(NetEvent *ne, ink_hrtime now, int &handle_event, int &closed,
int &total_idle_time, int &total_idle_count);
diff --git a/src/iocore/net/NetHandler.cc b/src/iocore/net/NetHandler.cc
index f83f09ad48..1b36780051 100644
--- a/src/iocore/net/NetHandler.cc
+++ b/src/iocore/net/NetHandler.cc
@@ -42,7 +42,7 @@ DbgCtl dbg_ctl_v_net_queue{"v_net_queue"};
} // end anonymous namespace
-std::atomic<uint32_t> NetHandler::additional_accepts{0};
+std::atomic<int32_t> NetHandler::additional_accepts{0};
std::atomic<uint32_t> NetHandler::per_client_max_connections_in{0};
// NetHandler method definitions
@@ -185,13 +185,16 @@ NetHandler::init_for_process()
REC_ReadConfigInt32(global_config.default_inactivity_timeout,
"proxy.config.net.default_inactivity_timeout");
// Atomic configurations.
- uint32_t val = 0;
-
- REC_ReadConfigInt32(val, "proxy.config.net.additional_accepts");
- additional_accepts.store(val, std::memory_order_relaxed);
-
- REC_ReadConfigInt32(val, "proxy.config.net.per_client.max_connections_in");
- per_client_max_connections_in.store(val, std::memory_order_relaxed);
+ {
+ int32_t val = 0;
+ REC_ReadConfigInt32(val, "proxy.config.net.additional_accepts");
+ additional_accepts.store(val, std::memory_order_relaxed);
+ }
+ {
+ uint32_t val = 0;
+ REC_ReadConfigInt32(val, "proxy.config.net.per_client.max_connections_in");
+ per_client_max_connections_in.store(val, std::memory_order_relaxed);
+ }
RecRegisterConfigUpdateCb("proxy.config.net.max_connections_in",
update_nethandler_config, nullptr);
RecRegisterConfigUpdateCb("proxy.config.net.max_requests_in",
update_nethandler_config, nullptr);
diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc
index f66726cb3e..7cd10fc354 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -722,7 +722,7 @@ static const RecordElement RecordsConfig[] =
//#
//##############################################################################
- {RECT_CONFIG, "proxy.config.net.additional_accepts", RECD_INT, "-1",
RECU_DYNAMIC, RR_NULL, RECC_INT, "^-1|[0-9]+$", RECA_NULL}
+ {RECT_CONFIG, "proxy.config.net.additional_accepts", RECD_INT, "-1",
RECU_DYNAMIC, RR_NULL, RECC_STR, "^-1|[0-9]+$", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.net.connections_throttle", RECD_INT, "30000",
RECU_RESTART_TS, RR_REQUIRED, RECC_STR, "^[0-9]+$", RECA_NULL}
,