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;
|
bool start_as_daemon = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static auto logcat = llarp::log::Cat("main");
|
||||||
std::shared_ptr<llarp::Context> ctx;
|
std::shared_ptr<llarp::Context> ctx;
|
||||||
std::promise<int> exit_code;
|
std::promise<int> exit_code;
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_signal(int sig)
|
handle_signal(int sig)
|
||||||
{
|
{
|
||||||
|
llarp::log::info(logcat, "Handling signal {}", sig);
|
||||||
if (ctx)
|
if (ctx)
|
||||||
ctx->loop->call([sig] { ctx->HandleSignal(sig); });
|
ctx->loop->call([sig] { ctx->HandleSignal(sig); });
|
||||||
else
|
else
|
||||||
|
@ -647,7 +649,8 @@ SvcCtrlHandler(DWORD dwCtrl)
|
||||||
switch (dwCtrl)
|
switch (dwCtrl)
|
||||||
{
|
{
|
||||||
case SERVICE_CONTROL_STOP:
|
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);
|
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||||
// do the actual tear down
|
// do the actual tear down
|
||||||
handle_signal(SIGINT);
|
handle_signal(SIGINT);
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static auto logcat = llarp::log::Cat("llarp-context");
|
||||||
|
|
||||||
namespace llarp
|
namespace llarp
|
||||||
{
|
{
|
||||||
bool
|
bool
|
||||||
|
@ -159,6 +161,7 @@ namespace llarp
|
||||||
void
|
void
|
||||||
Context::HandleSignal(int sig)
|
Context::HandleSignal(int sig)
|
||||||
{
|
{
|
||||||
|
llarp::log::debug(logcat, "Handling signal {}", sig);
|
||||||
if (sig == SIGINT || sig == SIGTERM)
|
if (sig == SIGINT || sig == SIGTERM)
|
||||||
{
|
{
|
||||||
SigINT();
|
SigINT();
|
||||||
|
@ -188,6 +191,7 @@ namespace llarp
|
||||||
{
|
{
|
||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
|
llarp::log::debug(logcat, "Handling SIGINT");
|
||||||
/// async stop router on sigint
|
/// async stop router on sigint
|
||||||
router->Stop();
|
router->Stop();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue