|
|
@ -14,12 +14,13 @@ namespace i2p |
|
|
|
|
|
|
|
|
|
|
|
RouterContext::RouterContext (): |
|
|
|
RouterContext::RouterContext (): |
|
|
|
m_LastUpdateTime (0), m_IsUnreachable (false), m_AcceptsTunnels (true), |
|
|
|
m_LastUpdateTime (0), m_IsUnreachable (false), m_AcceptsTunnels (true), |
|
|
|
m_IsFloodfill (false) |
|
|
|
m_IsFloodfill (false), m_StartupTime (0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void RouterContext::Init () |
|
|
|
void RouterContext::Init () |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
m_StartupTime = i2p::util::GetSecondsSinceEpoch (); |
|
|
|
if (!Load ()) |
|
|
|
if (!Load ()) |
|
|
|
CreateNewRouter (); |
|
|
|
CreateNewRouter (); |
|
|
|
UpdateRouterInfo (); |
|
|
|
UpdateRouterInfo (); |
|
|
@ -218,5 +219,10 @@ namespace i2p |
|
|
|
void RouterContext::HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from) |
|
|
|
void RouterContext::HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from) |
|
|
|
{ |
|
|
|
{ |
|
|
|
i2p::HandleI2NPMessage (CreateI2NPMessage (buf, GetI2NPMessageLength (buf), from)); |
|
|
|
i2p::HandleI2NPMessage (CreateI2NPMessage (buf, GetI2NPMessageLength (buf), from)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t RouterContext::GetUptime () const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return i2p::util::GetSecondsSinceEpoch () - m_StartupTime; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|