Add some more debugging

pull/2045/head
Jason Rhinelander 2 years ago committed by Jeff Becker
parent 64cf268457
commit 5c12110e93
No known key found for this signature in database
GPG Key ID: 025C02EE3A092F2D

@ -517,9 +517,10 @@ namespace llarp
void void
Router::Close() Router::Close()
{ {
log::info(logcat, "closing");
if (_onDown) if (_onDown)
_onDown(); _onDown();
LogInfo("closing router"); log::debug(logcat, "stopping mainloop");
_loop->stop(); _loop->stop();
_running.store(false); _running.store(false);
} }
@ -1498,13 +1499,16 @@ namespace llarp
Router::AfterStopLinks() Router::AfterStopLinks()
{ {
Close(); Close();
log::debug(logcat, "stopping oxenmq");
m_lmq.reset(); m_lmq.reset();
} }
void void
Router::AfterStopIssued() Router::AfterStopIssued()
{ {
log::debug(logcat, "stopping links");
StopLinks(); StopLinks();
log::debug(logcat, "saving nodedb to disk");
nodedb()->SaveToDisk(); nodedb()->SaveToDisk();
_loop->call_later(200ms, [this] { AfterStopLinks(); }); _loop->call_later(200ms, [this] { AfterStopLinks(); });
} }
@ -1538,18 +1542,28 @@ namespace llarp
Router::Stop() Router::Stop()
{ {
if (!_running) if (!_running)
{
log::debug(logcat, "Stop called, but not running");
return; return;
}
if (_stopping) if (_stopping)
{
log::debug(logcat, "Stop called, but already stopping");
return; return;
}
_stopping.store(true); _stopping.store(true);
if (log::get_level_default() != log::Level::off) if (log::get_level_default() != log::Level::off)
log::reset_level(log::Level::info); log::reset_level(log::Level::info);
LogInfo("stopping router"); log::info(logcat, "stopping");
llarp::sys::service_manager->stopping(); llarp::sys::service_manager->stopping();
log::debug(logcat, "stopping hidden service context");
hiddenServiceContext().StopAll(); hiddenServiceContext().StopAll();
log::debug(logcat, "stopping exit context");
_exitContext.Stop(); _exitContext.Stop();
log::debug(logcat, "final upstream pump");
paths.PumpUpstream(); paths.PumpUpstream();
log::debug(logcat, "final links pump");
_linkManager.PumpLinks(); _linkManager.PumpLinks();
_loop->call_later(200ms, [this] { AfterStopIssued(); }); _loop->call_later(200ms, [this] { AfterStopIssued(); });
} }

Loading…
Cancel
Save