only ping lokid if a service node

This commit is contained in:
Jeff Becker 2020-01-06 18:13:23 -05:00
parent 9214ecbc48
commit e5f92eaa79
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
3 changed files with 10 additions and 4 deletions

View File

@ -131,6 +131,9 @@ namespace llarp
virtual bool virtual bool
Configure(Config *conf, llarp_nodedb *nodedb) = 0; Configure(Config *conf, llarp_nodedb *nodedb) = 0;
virtual bool
IsServiceNode() const = 0;
virtual bool virtual bool
StartJsonRpc() = 0; StartJsonRpc() = 0;

View File

@ -323,7 +323,7 @@ namespace llarp
/// return true if we are running in service node mode /// return true if we are running in service node mode
bool bool
IsServiceNode() const; IsServiceNode() const override;
void void
Close(); Close();

View File

@ -181,11 +181,14 @@ namespace llarp
AsyncUpdatePubkeyList(); AsyncUpdatePubkeyList();
m_NextKeyUpdate = now + KeyUpdateInterval; m_NextKeyUpdate = now + KeyUpdateInterval;
} }
if(router->IsServiceNode())
{
if(now >= m_NextPing) if(now >= m_NextPing)
{ {
AsyncLokiPing(); AsyncLokiPing();
m_NextPing = now + PingInterval; m_NextPing = now + PingInterval;
} }
}
Flush(); Flush();
} }