From e5f92eaa798c07af7d0e1be0385c31e88f594c23 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 6 Jan 2020 18:13:23 -0500 Subject: [PATCH] only ping lokid if a service node --- llarp/router/abstractrouter.hpp | 3 +++ llarp/router/router.hpp | 2 +- llarp/rpc/rpc.cpp | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/llarp/router/abstractrouter.hpp b/llarp/router/abstractrouter.hpp index 17d63e34a..6f92bbda3 100644 --- a/llarp/router/abstractrouter.hpp +++ b/llarp/router/abstractrouter.hpp @@ -131,6 +131,9 @@ namespace llarp virtual bool Configure(Config *conf, llarp_nodedb *nodedb) = 0; + virtual bool + IsServiceNode() const = 0; + virtual bool StartJsonRpc() = 0; diff --git a/llarp/router/router.hpp b/llarp/router/router.hpp index 8ac4df0a9..0e1c68f7b 100644 --- a/llarp/router/router.hpp +++ b/llarp/router/router.hpp @@ -323,7 +323,7 @@ namespace llarp /// return true if we are running in service node mode bool - IsServiceNode() const; + IsServiceNode() const override; void Close(); diff --git a/llarp/rpc/rpc.cpp b/llarp/rpc/rpc.cpp index edc08cef5..468d5b34e 100644 --- a/llarp/rpc/rpc.cpp +++ b/llarp/rpc/rpc.cpp @@ -181,10 +181,13 @@ namespace llarp AsyncUpdatePubkeyList(); m_NextKeyUpdate = now + KeyUpdateInterval; } - if(now >= m_NextPing) + if(router->IsServiceNode()) { - AsyncLokiPing(); - m_NextPing = now + PingInterval; + if(now >= m_NextPing) + { + AsyncLokiPing(); + m_NextPing = now + PingInterval; + } } Flush(); }