server.setVerbose(verbose_mode);
// Create our PID file.
- server.setProcName(DHCP4_NAME);
+ server.setProcName(DHCP4_NAME);
server.setConfigFile(config_file);
server.createPIDFile();
bool Daemon::verbose_ = false;
+std::string Daemon::proc_name_("");
+
std::string Daemon::default_logger_name_("kea");
Daemon::Daemon()
- : signal_set_(), signal_handler_(), config_file_(""), proc_name_(""),
+ : signal_set_(), signal_handler_(), config_file_(""),
pid_file_dir_(DATA_DIR), pid_file_(), am_file_author_(false) {
// The pid_file_dir can be overridden via environment variable
}
std::string
-Daemon::getProcName() const {
+Daemon::getProcName() {
return (proc_name_);
};
/// @brief returns the process name
/// This value is used as when forming the default PID file name
/// @return text string
- std::string getProcName() const;
+ static std::string getProcName();
/// @brief Sets the process name
/// @param proc_name name the process by which the process is recognized
- void setProcName(const std::string& proc_name);
+ static void setProcName(const std::string& proc_name);
/// @brief Returns the directory used when forming default PID file name
/// @return text string
std::string config_file_;
/// @brief Name of this process, used when creating its pid file
- std::string proc_name_;
+ static std::string proc_name_;
/// @brief Pointer to the directory where PID file(s) are written
/// It defaults to --localstatedir / run
EXPECT_FALSE(instance2.getVerbose());
EXPECT_TRUE(instance2.getConfigFile().empty());
- EXPECT_TRUE(instance2.getProcName().empty());
+ EXPECT_EQ("TestBin", instance2.getProcName());
EXPECT_EQ(std::string(DATA_DIR), instance2.getPIDFileDir());
EXPECT_TRUE(instance2.getPIDFileName().empty());
}