void kill_pg(int signo) noexcept;
public:
+ // Constructor for a base_process_service. Note that the various parameters not specified here must in
+ // general be set separately (using the appropriate set_xxx function for each).
base_process_service(service_set *sset, string name, service_type_t record_type_p, string &&command,
std::list<std::pair<unsigned,unsigned>> &command_offsets,
const std::list<prelim_dep> &deplist_p);
extern pid_t last_forked_pid;
}
+static void init_service_defaults(process_service &ps)
+{
+ ps.set_restart_interval(time_val(10,0), 3);
+ ps.set_restart_delay(time_val(0, 200000000)); // 200 milliseconds
+ ps.set_stop_timeout(time_val(10,0));
+ ps.set_start_timeout(time_val(10,0));
+ ps.set_start_interruptible(false);
+}
+
// Regular service start
void test_proc_service_start()
{
std::list<prelim_dep> depends;
process_service p = process_service(&sset, "testproc", std::move(command), command_offsets, depends);
+ init_service_defaults(p);
+
p.start(true);
sset.process_queues();
std::list<prelim_dep> depends;
process_service p = process_service(&sset, "testproc", std::move(command), command_offsets, depends);
+ init_service_defaults(p);
+
p.start(true);
sset.process_queues();
std::list<prelim_dep> depends;
process_service p = process_service(&sset, "testproc", std::move(command), command_offsets, depends);
+ init_service_defaults(p);
+
p.start(true);
sset.process_queues();
std::list<prelim_dep> depends;
process_service p = process_service(&sset, "testproc", std::move(command), command_offsets, depends);
+ init_service_defaults(p);
+
p.start(true);
sset.process_queues();
std::list<prelim_dep> depends;
process_service p = process_service(&sset, "testproc", std::move(command), command_offsets, depends);
+ init_service_defaults(p);
p.set_smooth_recovery(true);
p.start(true);
assert(p.get_state() == service_state_t::STARTED);
}
+// Smooth recovery without restart delay
void test_proc_smooth_recovery2()
{
using namespace std;
std::list<prelim_dep> depends;
process_service p = process_service(&sset, "testproc", std::move(command), command_offsets, depends);
+ init_service_defaults(p);
p.set_smooth_recovery(true);
p.set_restart_delay(time_val(0, 0));