mirror of https://github.com/oxen-io/lokinet
some useful log statements
This commit is contained in:
parent
9cdfae2e42
commit
7ddad87dbf
|
@ -34,12 +34,14 @@ SERVICE_STATUS_HANDLE SvcStatusHandle;
|
|||
bool start_as_daemon = false;
|
||||
#endif
|
||||
|
||||
static auto logcat = llarp::log::Cat("main");
|
||||
std::shared_ptr<llarp::Context> ctx;
|
||||
std::promise<int> exit_code;
|
||||
|
||||
void
|
||||
handle_signal(int sig)
|
||||
{
|
||||
llarp::log::info(logcat, "Handling signal {}", sig);
|
||||
if (ctx)
|
||||
ctx->loop->call([sig] { ctx->HandleSignal(sig); });
|
||||
else
|
||||
|
@ -647,7 +649,8 @@ SvcCtrlHandler(DWORD dwCtrl)
|
|||
switch (dwCtrl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
// tell servicve we are stopping
|
||||
// tell service we are stopping
|
||||
llarp::log::info(logcat, "Windows service controller gave SERVICE_CONTROL_STOP");
|
||||
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||
// do the actual tear down
|
||||
handle_signal(SIGINT);
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
static auto logcat = llarp::log::Cat("llarp-context");
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
bool
|
||||
|
@ -159,6 +161,7 @@ namespace llarp
|
|||
void
|
||||
Context::HandleSignal(int sig)
|
||||
{
|
||||
llarp::log::debug(logcat, "Handling signal {}", sig);
|
||||
if (sig == SIGINT || sig == SIGTERM)
|
||||
{
|
||||
SigINT();
|
||||
|
@ -188,6 +191,7 @@ namespace llarp
|
|||
{
|
||||
if (router)
|
||||
{
|
||||
llarp::log::debug(logcat, "Handling SIGINT");
|
||||
/// async stop router on sigint
|
||||
router->Stop();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue