mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
NTP sync in separate thread
This commit is contained in:
parent
d7081c5f23
commit
8a549b83a2
3 changed files with 110 additions and 11 deletions
|
@ -42,6 +42,7 @@ namespace i2p
|
|||
std::unique_ptr<i2p::http::HTTPServer> httpServer;
|
||||
std::unique_ptr<i2p::client::I2PControlService> m_I2PControlService;
|
||||
std::unique_ptr<i2p::transport::UPnP> UPnP;
|
||||
std::unique_ptr<i2p::util::NTPTimeSync> m_NTPSync;
|
||||
#ifdef WITH_EVENTS
|
||||
std::unique_ptr<i2p::event::WebsocketServer> m_WebsocketServer;
|
||||
#endif
|
||||
|
@ -284,7 +285,11 @@ namespace i2p
|
|||
}
|
||||
|
||||
bool nettime; i2p::config::GetOption("nettime.enabled", nettime);
|
||||
if (nettime) i2p::util::RequestNTPTimeSync ();
|
||||
if (nettime)
|
||||
{
|
||||
d.m_NTPSync = std::unique_ptr<i2p::util::NTPTimeSync>(new i2p::util::NTPTimeSync);
|
||||
d.m_NTPSync->Start ();
|
||||
}
|
||||
|
||||
bool ntcp; i2p::config::GetOption("ntcp", ntcp);
|
||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
||||
|
@ -355,11 +360,18 @@ namespace i2p
|
|||
LogPrint(eLogInfo, "Daemon: stopping Tunnels");
|
||||
i2p::tunnel::tunnels.Stop();
|
||||
|
||||
if (d.UPnP) {
|
||||
if (d.UPnP)
|
||||
{
|
||||
d.UPnP->Stop ();
|
||||
d.UPnP = nullptr;
|
||||
}
|
||||
|
||||
if (d.m_NTPSync)
|
||||
{
|
||||
d.m_NTPSync->Stop ();
|
||||
d.m_NTPSync = nullptr;
|
||||
}
|
||||
|
||||
LogPrint(eLogInfo, "Daemon: stopping Transports");
|
||||
i2p::transport::transports.Stop();
|
||||
LogPrint(eLogInfo, "Daemon: stopping NetDB");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue