diff options
author | Razvan Becheriu <razvan@isc.org> | 2020-08-18 20:47:18 +0200 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2020-08-18 22:11:25 +0200 |
commit | d86ef62b6c3aa3c5c9815a70c3e99dc4f35006de (patch) | |
tree | 3386dd587cc201d30c8f402341d3d8bd7fdbe275 /src/bin/dhcp4 | |
parent | [#1305] add thread and queue info to get-status command (diff) | |
download | kea-d86ef62b6c3aa3c5c9815a70c3e99dc4f35006de.tar.xz kea-d86ef62b6c3aa3c5c9815a70c3e99dc4f35006de.zip |
[#1305] addresses comments
Diffstat (limited to 'src/bin/dhcp4')
-rw-r--r-- | src/bin/dhcp4/ctrl_dhcp4_srv.cc | 11 | ||||
-rw-r--r-- | src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc | 18 |
2 files changed, 23 insertions, 6 deletions
diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index f6a06b8a89..c38966d2e7 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -661,10 +661,13 @@ ControlledDhcpv4Srv::commandStatusGetHandler(const string&, } if (MultiThreadingMgr::instance().getMode()) { - status->set("thread-pool-size", Element::create( - long(MultiThreadingMgr::instance().getThreadPoolSize()))); - status->set("packet-queue-size", Element::create( - long(MultiThreadingMgr::instance().getPacketQueueSize()))); + status->set("multi-threading-enabled", Element::create(true)); + status->set("thread-pool-size", Element::create(static_cast<int32_t>( + MultiThreadingMgr::instance().getThreadPoolSize()))); + status->set("packet-queue-size", Element::create(static_cast<int32_t>( + MultiThreadingMgr::instance().getPacketQueueSize()))); + } else { + status->set("multi-threading-enabled", Element::create(false)); } return (createAnswer(0, status)); diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 22efe381e0..e601e8d309 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -1120,6 +1120,16 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) { EXPECT_LE(found_reload->intValue(), 5); EXPECT_GE(found_reload->intValue(), 0); + auto found_multi_threading = arguments->get("multi-threading-enabled"); + ASSERT_TRUE(found_multi_threading); + EXPECT_EQ(false, found_multi_threading->boolValue()); + + auto found_thread_count = arguments->get("thread-pool-size"); + ASSERT_FALSE(found_thread_count); + + auto found_queue_size = arguments->get("packet-queue-size"); + ASSERT_FALSE(found_queue_size); + MultiThreadingMgr::instance().setMode(true); MultiThreadingMgr::instance().setThreadPoolSize(4); MultiThreadingMgr::instance().setPacketQueueSize(64); @@ -1153,11 +1163,15 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) { EXPECT_LE(found_reload->intValue(), 5); EXPECT_GE(found_reload->intValue(), 0); - auto found_thread_count = arguments->get("thread-pool-size"); + found_multi_threading = arguments->get("multi-threading-enabled"); + ASSERT_TRUE(found_multi_threading); + EXPECT_EQ(true, found_multi_threading->boolValue()); + + found_thread_count = arguments->get("thread-pool-size"); ASSERT_TRUE(found_thread_count); EXPECT_EQ(found_thread_count->intValue(), 4); - auto found_queue_size = arguments->get("packet-queue-size"); + found_queue_size = arguments->get("packet-queue-size"); ASSERT_TRUE(found_queue_size); EXPECT_EQ(found_queue_size->intValue(), 64); } |