mirror of https://github.com/oxen-io/lokinet
wire up sigusr1 to reset libunbound dns resolver
This commit is contained in:
parent
6825e9177d
commit
ffef3bc48f
|
@ -279,6 +279,7 @@ run_main_context(std::optional<fs::path> confFile, const llarp::RuntimeOptions o
|
|||
signal(SIGTERM, handle_signal);
|
||||
#ifndef _WIN32
|
||||
signal(SIGHUP, handle_signal);
|
||||
signal(SIGUSR1, handle_signal);
|
||||
#endif
|
||||
|
||||
ctx->Setup(opts);
|
||||
|
|
|
@ -158,6 +158,10 @@ namespace llarp
|
|||
{
|
||||
Reload();
|
||||
}
|
||||
if (sig == SIGUSR1 and router)
|
||||
{
|
||||
router->Thaw();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,16 @@ namespace llarp
|
|||
return *itr;
|
||||
}
|
||||
|
||||
void
|
||||
Proxy::Restart()
|
||||
{
|
||||
if (m_UnboundResolver)
|
||||
{
|
||||
LogInfo("reset libunbound's internal stuff");
|
||||
m_UnboundResolver->Init();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Proxy::SetupUnboundResolver(const std::vector<IpAddress>& resolvers)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace llarp
|
|||
void
|
||||
Stop();
|
||||
|
||||
void
|
||||
Restart();
|
||||
|
||||
using Buffer_t = std::vector<uint8_t>;
|
||||
|
||||
private:
|
||||
|
|
|
@ -76,6 +76,13 @@ namespace llarp
|
|||
return obj;
|
||||
}
|
||||
|
||||
void
|
||||
TunEndpoint::Thaw()
|
||||
{
|
||||
if (m_Resolver)
|
||||
m_Resolver->Restart();
|
||||
}
|
||||
|
||||
bool
|
||||
TunEndpoint::Configure(const NetworkConfig& conf, const DnsConfig& dnsConf)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,9 @@ namespace llarp
|
|||
return shared_from_this();
|
||||
}
|
||||
|
||||
void
|
||||
Thaw() override;
|
||||
|
||||
bool
|
||||
Configure(const NetworkConfig& conf, const DnsConfig& dnsConf) override;
|
||||
|
||||
|
|
|
@ -198,6 +198,10 @@ namespace llarp
|
|||
virtual void
|
||||
Stop() = 0;
|
||||
|
||||
/// thaw from long sleep or network changed event
|
||||
virtual void
|
||||
Thaw() = 0;
|
||||
|
||||
/// non gracefully stop the router
|
||||
virtual void
|
||||
Die() = 0;
|
||||
|
|
|
@ -121,6 +121,18 @@ namespace llarp
|
|||
return inbound_link_msg_parser.ProcessFrom(session, buf);
|
||||
}
|
||||
|
||||
void
|
||||
Router::Thaw()
|
||||
{
|
||||
LogInfo("We arise from a long sleep, probably need to reset the network state");
|
||||
hiddenServiceContext().ForEachService([](const auto& name, const auto& ep) -> bool {
|
||||
LogInfo(name, " thawing...");
|
||||
ep->Thaw();
|
||||
return true;
|
||||
});
|
||||
LogInfo("We are ready to go bruh");
|
||||
}
|
||||
|
||||
void
|
||||
Router::PersistSessionUntil(const RouterID& remote, llarp_time_t until)
|
||||
{
|
||||
|
|
|
@ -363,6 +363,9 @@ namespace llarp
|
|||
bool
|
||||
StartRpcServer() override;
|
||||
|
||||
void
|
||||
Thaw() override;
|
||||
|
||||
bool
|
||||
Run() override;
|
||||
|
||||
|
|
|
@ -127,6 +127,9 @@ namespace llarp
|
|||
return {0};
|
||||
}
|
||||
|
||||
virtual void
|
||||
Thaw(){};
|
||||
|
||||
void
|
||||
ResetInternalState() override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue