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