diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:36:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 11:36:04 +0000 |
commit | 040eee1aa49b49df4698d83a05af57c220127fd1 (patch) | |
tree | f635435954e6ccde5eee9893889e24f30ca68346 /src/lib/dhcpsrv/cfg_multi_threading.cc | |
parent | Initial commit. (diff) | |
download | isc-kea-upstream.tar.xz isc-kea-upstream.zip |
Adding upstream version 2.2.0.upstream/2.2.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/dhcpsrv/cfg_multi_threading.cc')
-rw-r--r-- | src/lib/dhcpsrv/cfg_multi_threading.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/cfg_multi_threading.cc b/src/lib/dhcpsrv/cfg_multi_threading.cc new file mode 100644 index 0000000..c31e6a7 --- /dev/null +++ b/src/lib/dhcpsrv/cfg_multi_threading.cc @@ -0,0 +1,51 @@ +// Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <cc/data.h> +#include <cc/simple_parser.h> +#include <cfg_multi_threading.h> +#include <util/multi_threading_mgr.h> + +using namespace isc::data; +using namespace isc::util; + +namespace isc { +namespace dhcp { + +void +CfgMultiThreading::apply(ConstElementPtr value) { + bool enabled = false; + uint32_t thread_count = 0; + uint32_t queue_size = 0; + CfgMultiThreading::extract(value, enabled, thread_count, queue_size); + MultiThreadingMgr::instance().apply(enabled, thread_count, queue_size); +} + +void +CfgMultiThreading::extract(ConstElementPtr value, bool& enabled, + uint32_t& thread_count, uint32_t& queue_size) { + enabled = false; + thread_count = 0; + queue_size = 0; + if (value) { + if (value->get("enable-multi-threading")) { + enabled = SimpleParser::getBoolean(value, "enable-multi-threading"); + } + + if (value->get("thread-pool-size")) { + thread_count = SimpleParser::getInteger(value, "thread-pool-size"); + } + + if (value->get("packet-queue-size")) { + queue_size = SimpleParser::getInteger(value, "packet-queue-size"); + } + } +} + +} // namespace dhcp +} // namespace isc |