mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#893] enable command line parameters
This commit is contained in:
@@ -170,7 +170,15 @@ ControlledDhcpv4Srv::loadConfigFile(const std::string& file_name) {
|
||||
}
|
||||
|
||||
// @todo enable multi-threading - disabled for now
|
||||
MultiThreadingMgr::instance().apply(false,
|
||||
bool enabled = false;
|
||||
if (srv_thread_count >= 0) {
|
||||
enabled = true;
|
||||
}
|
||||
if (enabled) {
|
||||
CfgMgr::instance().getCurrentCfg()->setServerThreadCount(srv_thread_count);
|
||||
CfgMgr::instance().getCurrentCfg()->setServerMaxThreadQueueSize(4);
|
||||
}
|
||||
MultiThreadingMgr::instance().apply(enabled,
|
||||
CfgMgr::instance().getCurrentCfg()->getServerThreadCount());
|
||||
|
||||
// Now check is the returned result is successful (rcode=0) or not
|
||||
@@ -193,10 +201,10 @@ ControlledDhcpv4Srv::loadConfigFile(const std::string& file_name) {
|
||||
<< file_name << "': " << ex.what());
|
||||
}
|
||||
|
||||
LOG_INFO(dhcp4_logger, DHCP4_MULTI_THREADING_INFO)
|
||||
.arg(MultiThreadingMgr::instance().getMode())
|
||||
LOG_WARN(dhcp4_logger, DHCP4_MULTI_THREADING_INFO)
|
||||
.arg(MultiThreadingMgr::instance().getMode() ? "yes" : "no")
|
||||
.arg(MultiThreadingMgr::instance().getPktThreadPoolSize())
|
||||
.arg(CfgMgr::instance().getCurrentCfg()->getServerMaxThreadQueueSize());
|
||||
.arg(CfgMgr::instance().getCurrentCfg()->getPktThreadQueueSize());
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@@ -713,5 +713,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
|
||||
return (answer);
|
||||
}
|
||||
|
||||
}; // end of isc::dhcp namespace
|
||||
}; // end of isc namespace
|
||||
int srv_thread_count = -1;
|
||||
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
@@ -60,7 +60,9 @@ configureDhcp4Server(Dhcpv4Srv&,
|
||||
isc::data::ConstElementPtr config_set,
|
||||
bool check_only = false);
|
||||
|
||||
}; // end of isc::dhcp namespace
|
||||
}; // end of isc namespace
|
||||
extern int srv_thread_count;
|
||||
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
||||
#endif // DHCP4_CONFIG_PARSER_H
|
||||
|
@@ -59,8 +59,8 @@ usage() {
|
||||
<< "(useful for testing only)" << endl;
|
||||
cerr << " -P number: specify non-standard client port number 1-65535 "
|
||||
<< "(useful for testing only)" << endl;
|
||||
cerr << " -N number: specify thread count 0-65535 "
|
||||
<< "(0 means multi-threading disabled)" << endl;
|
||||
cerr << " -N number: enable multi-threading and set thread count 0-65535 "
|
||||
<< "(0 means auto detect)" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} // namespace
|
||||
@@ -148,6 +148,8 @@ main(int argc, char* argv[]) {
|
||||
cerr << "Failed to parse thread count number: [" << optarg
|
||||
<< "], 0-65535 allowed." << endl;
|
||||
usage();
|
||||
} else {
|
||||
srv_thread_count = thread_count;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -141,7 +141,15 @@ ControlledDhcpv6Srv::loadConfigFile(const std::string& file_name) {
|
||||
}
|
||||
|
||||
// @todo enable multi-threading - disabled for now
|
||||
MultiThreadingMgr::instance().apply(false,
|
||||
bool enabled = false;
|
||||
if (srv_thread_count >= 0) {
|
||||
enabled = true;
|
||||
}
|
||||
if (enabled) {
|
||||
CfgMgr::instance().getCurrentCfg()->setServerThreadCount(srv_thread_count);
|
||||
CfgMgr::instance().getCurrentCfg()->setServerMaxThreadQueueSize(4);
|
||||
}
|
||||
MultiThreadingMgr::instance().apply(enabled,
|
||||
CfgMgr::instance().getCurrentCfg()->getServerThreadCount());
|
||||
|
||||
// Now check is the returned result is successful (rcode=0) or not
|
||||
@@ -164,10 +172,10 @@ ControlledDhcpv6Srv::loadConfigFile(const std::string& file_name) {
|
||||
<< file_name << "': " << ex.what());
|
||||
}
|
||||
|
||||
LOG_INFO(dhcp6_logger, DHCP6_MULTI_THREADING_INFO)
|
||||
.arg(MultiThreadingMgr::instance().getMode())
|
||||
LOG_WARN(dhcp6_logger, DHCP6_MULTI_THREADING_INFO)
|
||||
.arg(MultiThreadingMgr::instance().getMode() ? "yes" : "no")
|
||||
.arg(MultiThreadingMgr::instance().getPktThreadPoolSize())
|
||||
.arg(CfgMgr::instance().getCurrentCfg()->getServerMaxThreadQueueSize());
|
||||
.arg(CfgMgr::instance().getCurrentCfg()->getPktThreadQueueSize());
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@@ -841,5 +841,7 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
|
||||
return (answer);
|
||||
}
|
||||
|
||||
}; // end of isc::dhcp namespace
|
||||
}; // end of isc namespace
|
||||
int srv_thread_count = -1;
|
||||
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
@@ -44,7 +44,9 @@ isc::data::ConstElementPtr
|
||||
configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
|
||||
bool check_only = false);
|
||||
|
||||
}; // end of isc::dhcp namespace
|
||||
}; // end of isc namespace
|
||||
extern int srv_thread_count;
|
||||
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
||||
#endif // DHCP6_CONFIG_PARSER_H
|
||||
|
@@ -59,8 +59,8 @@ usage() {
|
||||
<< "(useful for testing only)" << endl;
|
||||
cerr << " -P number: specify non-standard client port number 1-65535 "
|
||||
<< "(useful for testing only)" << endl;
|
||||
cerr << " -N number: specify thread count 0-65535 "
|
||||
<< "(0 means multi-threading disabled)" << endl;
|
||||
cerr << " -N number: enable multi-threading and set thread count 0-65535 "
|
||||
<< "(0 means auto detect)" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} // namespace
|
||||
@@ -148,6 +148,8 @@ main(int argc, char* argv[]) {
|
||||
cerr << "Failed to parse thread count number: [" << optarg
|
||||
<< "], 0-65535 allowed." << endl;
|
||||
usage();
|
||||
} else {
|
||||
srv_thread_count = thread_count;
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user