diff --git a/llarp/CMakeLists.txt b/llarp/CMakeLists.txt index fa6feccf0..d42038665 100644 --- a/llarp/CMakeLists.txt +++ b/llarp/CMakeLists.txt @@ -208,6 +208,12 @@ if(TESTNET) endif() add_library(${STATIC_LIB} STATIC ${LIB_SRC}) + +if(WITH_HIVE) + set(LIB_SRC ${LIB_SRC} tooling/router_hive.cpp tooling/router_event.cpp) + target_include_directories(${STATIC_LIB} PUBLIC ${CMAKE_SOURCE_DIR}/tooling) +endif() + target_include_directories(${STATIC_LIB} PUBLIC ${CURL_INCLUDE_DIRS}) target_link_libraries(${STATIC_LIB} PUBLIC cxxopts ${ABYSS_LIB} ${PLATFORM_LIB} ${UTIL_LIB} ${CRYPTOGRAPHY_LIB}) diff --git a/llarp/router/abstractrouter.hpp b/llarp/router/abstractrouter.hpp index 7a9d8b93b..965a95d58 100644 --- a/llarp/router/abstractrouter.hpp +++ b/llarp/router/abstractrouter.hpp @@ -18,6 +18,7 @@ struct llarp_threadpool; namespace tooling { + struct RouterHive; struct RouterEvent; } // namespace tooling @@ -64,6 +65,11 @@ namespace llarp struct AbstractRouter { + +#ifdef LOKINET_HIVE + tooling::RouterHive* hive; +#endif + virtual ~AbstractRouter() = default; virtual bool @@ -267,7 +273,7 @@ namespace llarp GossipRCIfNeeded(const RouterContact rc) = 0; virtual void - NotifyRouterEvent(RouterEvent event) const = 0; + NotifyRouterEvent(tooling::RouterEvent event) const = 0; }; } // namespace llarp diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index cb66eb715..e86db1896 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -23,6 +23,11 @@ #include #include +#ifdef LOKINET_HIVE +#include "tooling/router_event.hpp" +#include "tooling/router_hive.hpp" +#endif + #include #include #include @@ -126,7 +131,7 @@ namespace llarp } void - Router::NotifyRouterEvent(RouterEvent event) const + Router::NotifyRouterEvent(tooling::RouterEvent event) const { #ifdef LOKINET_HIVE hive->NotifyEvent(event); diff --git a/llarp/router/router.hpp b/llarp/router/router.hpp index cc7f12dcd..c36b06e17 100644 --- a/llarp/router/router.hpp +++ b/llarp/router/router.hpp @@ -45,7 +45,6 @@ namespace tooling { - struct RouterHive; struct RouterEvent; } // namespace tooling @@ -288,10 +287,6 @@ namespace llarp TimePoint_t m_NextExploreAt; -#ifdef LOKINET_HIVE - RouterHive* hive; -#endif - IOutboundMessageHandler & outboundMessageHandler() override { @@ -320,7 +315,7 @@ namespace llarp GossipRCIfNeeded(const RouterContact rc) override; void - NotifyRouterEvent(RouterEvent event) const override; + NotifyRouterEvent(tooling::RouterEvent event) const override; Router(std::shared_ptr< llarp::thread::ThreadPool > worker, llarp_ev_loop_ptr __netloop, std::shared_ptr< Logic > logic);