delete rval;
if (service_type == service_type::PROCESS) {
auto rvalps = new process_service(this, string(name), std::move(command),
- command_offsets, &depends_on, &depends_soft);
+ command_offsets, std::move(depends_on), depends_soft);
rvalps->set_restart_interval(restart_interval, max_restarts);
rvalps->set_restart_delay(restart_delay);
rval = rvalps;
}
else if (service_type == service_type::BGPROCESS) {
auto rvalps = new bgproc_service(this, string(name), std::move(command),
- command_offsets, &depends_on, &depends_soft);
+ command_offsets, std::move(depends_on), depends_soft);
rvalps->set_pid_file(std::move(pid_file));
rvalps->set_restart_interval(restart_interval, max_restarts);
rvalps->set_restart_delay(restart_delay);
}
else if (service_type == service_type::SCRIPTED) {
rval = new scripted_service(this, string(name), std::move(command),
- command_offsets, &depends_on, &depends_soft);
+ command_offsets, std::move(depends_on), depends_soft);
rval->setStopCommand(stop_command, stop_command_offsets);
}
else {
- rval = new service_record(this, string(name), service_type, std::move(command), command_offsets,
- &depends_on, &depends_soft);
+ rval = new service_record(this, string(name), service_type,
+ std::move(command), command_offsets,
+ std::move(depends_on), depends_soft);
}
rval->setLogfile(logfile);
rval->setAutoRestart(auto_restart);
base_process_service::base_process_service(service_set *sset, string name, service_type service_type_p, string &&command,
std::list<std::pair<unsigned,unsigned>> &command_offsets,
- sr_list * pdepends_on, sr_list * pdepends_soft)
+ sr_list &&pdepends_on, const sr_list &pdepends_soft)
: service_record(sset, name, service_type_p, std::move(command), command_offsets,
- pdepends_on, pdepends_soft), child_listener(this), child_status_listener(this)
+ std::move(pdepends_on), pdepends_soft), child_listener(this), child_status_listener(this)
{
restart_interval_count = 0;
restart_interval_time = {0, 0};
}
service_record(service_set *set, string name, service_type record_type_p,
- sr_list * pdepends_on, sr_list * pdepends_soft)
+ sr_list &&pdepends_on, const sr_list &pdepends_soft)
: service_record(set, name)
{
services = set;
service_name = name;
this->record_type = record_type_p;
- this->depends_on = std::move(*pdepends_on);
+ this->depends_on = std::move(pdepends_on);
for (sr_iter i = depends_on.begin(); i != depends_on.end(); ++i) {
(*i)->dependents.push_back(this);
// Soft dependencies
auto b_iter = soft_deps.end();
- for (sr_iter i = pdepends_soft->begin(); i != pdepends_soft->end(); ++i) {
+ for (auto i = pdepends_soft.begin(); i != pdepends_soft.end(); ++i) {
b_iter = soft_deps.emplace(b_iter, this, *i);
(*i)->soft_dpts.push_back(&(*b_iter));
++b_iter;
}
service_record(service_set *set, string name, service_type record_type_p, string &&command, std::list<std::pair<unsigned,unsigned>> &command_offsets,
- sr_list * pdepends_on, sr_list * pdepends_soft)
- : service_record(set, name, record_type_p, pdepends_on, pdepends_soft)
+ sr_list &&pdepends_on, const sr_list &pdepends_soft)
+ : service_record(set, name, record_type_p, std::move(pdepends_on), pdepends_soft)
{
program_name = std::move(command);
exec_arg_parts = separate_args(program_name, command_offsets);
public:
base_process_service(service_set *sset, string name, service_type record_type_p, string &&command,
std::list<std::pair<unsigned,unsigned>> &command_offsets,
- sr_list * pdepends_on, sr_list * pdepends_soft);
+ sr_list &&pdepends_on, const sr_list &pdepends_soft);
~base_process_service() noexcept
{
public:
process_service(service_set *sset, string name, string &&command,
std::list<std::pair<unsigned,unsigned>> &command_offsets,
- sr_list * pdepends_on, sr_list * pdepends_soft)
+ sr_list &&pdepends_on, const sr_list &pdepends_soft)
: base_process_service(sset, name, service_type::PROCESS, std::move(command), command_offsets,
- pdepends_on, pdepends_soft)
+ std::move(pdepends_on), pdepends_soft)
{
}
public:
bgproc_service(service_set *sset, string name, string &&command,
std::list<std::pair<unsigned,unsigned>> &command_offsets,
- sr_list * pdepends_on, sr_list * pdepends_soft)
+ sr_list &&pdepends_on, const sr_list &pdepends_soft)
: base_process_service(sset, name, service_type::BGPROCESS, std::move(command), command_offsets,
- pdepends_on, pdepends_soft)
+ std::move(pdepends_on), pdepends_soft)
{
doing_recovery = false;
}
public:
scripted_service(service_set *sset, string name, string &&command,
std::list<std::pair<unsigned,unsigned>> &command_offsets,
- sr_list * pdepends_on, sr_list * pdepends_soft)
+ sr_list &&pdepends_on, const sr_list &pdepends_soft)
: base_process_service(sset, name, service_type::SCRIPTED, std::move(command), command_offsets,
- pdepends_on, pdepends_soft)
+ std::move(pdepends_on), pdepends_soft)
{
}