lokinet/llarp/win32/service_manager.hpp
Jason Rhinelander 31c312ad41
Extend windows startup timeout
If wintun fails it seems to take about 15s, so extend the startup
timeout so that it can fail gracefully (and let us clean up before
exiting).

Also refactors the timeouts to chrono constants.
2022-11-01 11:05:59 -04:00

36 lines
878 B
C++

#pragma once
#include <chrono>
#include <llarp/util/service_manager.hpp>
#include <llarp/util/types.hpp>
namespace llarp::sys
{
class SVC_Manager : public I_SystemLayerManager
{
SERVICE_STATUS _status;
public:
SERVICE_STATUS_HANDLE handle;
// How long we tell Windows to give us to startup before assuming we have stalled/hung. The
// biggest potential time here is wintun, which if it is going to fail appears to take around
// 15s before doing so.
static constexpr auto StartupTimeout = 17s;
// How long we tell Windows to give us to fully stop before killing us.
static constexpr auto StopTimeout = 5s;
SVC_Manager();
void
system_changed_our_state(ServiceState st) override;
void
report_changed_state() override;
void
we_changed_our_state(ServiceState st) override;
};
} // namespace llarp::sys