Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetHandler - Use the right type to hold additional_accepts config value. #11659

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/iocore/net/NetHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class NetHandler : public Continuation, public EThread::LoopTailHandler
// 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);
Expand Down
19 changes: 11 additions & 8 deletions src/iocore/net/NetHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/records/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,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}
,
Expand Down