Commit 1c6b2862 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3769] Removed static from Daemon::config_file_ and proc_name_

Rendered config_file_ and proc_name_ instance members as there is
no reason for them to be static.
parent 5776ee0c
......@@ -229,7 +229,7 @@ TEST_F(DStubControllerTest, missingConfigFileArgument) {
int argc = 2;
// Record start time, and invoke launch().
EXPECT_THROW(launch(argc, argv), ProcessInitError);
EXPECT_THROW(launch(argc, argv), LaunchError);
/// @brief Tests launch with an operational error during application execution.
......@@ -34,14 +34,9 @@
namespace isc {
namespace dhcp {
// This is an initial config file location.
std::string Daemon::config_file_ = "";
std::string Daemon::proc_name_ = "";
: signal_set_(), signal_handler_(), pid_file_dir_(DHCP_DATA_DIR),
pid_file_(), am_file_author_(false) {
: signal_set_(), signal_handler_(), config_file_(""), proc_name_(""),
pid_file_dir_(DHCP_DATA_DIR), pid_file_(), am_file_author_(false) {
// The pid_file_dir can be overridden via environment variable
// This is primarily intended to simplify testing
......@@ -113,13 +108,18 @@ std::string Daemon::getVersion(bool /*extended*/) {
isc_throw(isc::NotImplemented, "Daemon::getVersion() called");
Daemon::getConfigFile() const {
return (config_file_);
Daemon::setConfigFile(const std::string& config_file) {
config_file_ = config_file;
Daemon::getProcName() {
Daemon::getProcName() const {
return (proc_name_);
......@@ -46,16 +46,6 @@ public:
/// Dhcpv6Srv) in tests, without going through the hassles of implemeting stub
/// methods.
/// This class comprises a static object holding a location of the configuration
/// file. The object must be static because it is instantiated by the signal
/// handler functions, which are static by their nature. The signal handlers
/// are used to reconfigure a running server and they need access to the
/// configuration file location. They get this access by calling
/// @c Daemon::getConfigFile function.
/// By default, the configuration file location is empty and its actual value
/// is assigned to the static object in @c Daemon::init function.
/// Classes derived from @c Daemon may install custom signal handlers using
/// @c isc::util::SignalSet class. This base class provides a declaration
/// of the @c SignalSet object that should be initialized in the derived
......@@ -81,6 +71,10 @@ public:
/// @brief Initializes the server.
/// @todo #3753 - This method should be revisited as its original purpose
/// has been lost. As of #3769, it has been superseded with setConfigFile().
/// None of the following is currently accurate.
/// Depending on the configuration backend, it establishes msgq session,
/// or reads the configuration file.
......@@ -111,11 +105,6 @@ public:
/// @brief Initiates shutdown procedure for the whole DHCPv6 server.
virtual void shutdown();
/// @brief Returns config file name.
static std::string getConfigFile() {
return (config_file_);
/// @brief Initializes logger
/// This method initializes logging system. It also sets the default
......@@ -169,19 +158,23 @@ public:
/// @return text string
static std::string getVersion(bool extended);
/// @brief Returns config file name.
/// @return text string
std::string getConfigFile() const;
/// @brief Sets the configuration file name
/// @param config_file pathname of the configuration file
static void setConfigFile(const std::string& config_file);
void setConfigFile(const std::string& config_file);
/// @brief returns the process name
/// This value is used as when forming the default PID file name
/// @return text string
static std::string getProcName();
std::string getProcName() const;
/// @brief Sets the process name
/// @param proc_name name the process by which the process is recognized
static void setProcName(const std::string& proc_name);
void setProcName(const std::string& proc_name);
/// @brief Returns the directory used when forming default PID file name
/// @return text string
......@@ -252,10 +245,10 @@ protected:
/// @brief Config file name or empty if config file not used.
static std::string config_file_;
std::string config_file_;
/// @brief Name of this process, used when creating its pid file
static std::string proc_name_;
std::string proc_name_;
/// @brief Pointer to the directory where PID file(s) are written
/// It defaults to --localstatedir
......@@ -65,9 +65,6 @@ public:
/// the default after each test completes.
~DaemonTest() {
// Since they're static we need to clear them between tests
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment