mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
ccc7b5c9e9
loop->call(...) is similar to the old logic->Call(...), but is smart about the current thread: if called from within the event loop it simply runs the argument directly, otherwise it queues it. Similarly most of the other event loop calls are also now thread-aware: for example, `call_later(...)` can queue the job directly when called if in the event loop rather than having to double-queue through the even loop (once to call, then inside the call to initiate the time).
39 lines
944 B
C++
39 lines
944 B
C++
#pragma once
|
|
|
|
#include <router/router.hpp>
|
|
|
|
namespace tooling
|
|
{
|
|
/// HiveRouter is a subclass of Router which overrides specific behavior in
|
|
/// order to perform testing-related functions. It exists largely to prevent
|
|
/// this behavior (which may often be "dangerous") from leaking into release
|
|
/// code.
|
|
struct HiveRouter : public llarp::Router
|
|
{
|
|
explicit HiveRouter(
|
|
llarp::EventLoop_ptr loop,
|
|
std::shared_ptr<llarp::vpn::Platform> vpnPlatform,
|
|
RouterHive* hive);
|
|
|
|
virtual ~HiveRouter() = default;
|
|
|
|
/// Override logic to prevent base Router class from gossiping its RC.
|
|
virtual bool
|
|
disableGossipingRC_TestingOnly() override;
|
|
|
|
void
|
|
disableGossiping();
|
|
|
|
void
|
|
enableGossiping();
|
|
|
|
protected:
|
|
bool m_disableGossiping = false;
|
|
RouterHive* m_hive = nullptr;
|
|
|
|
virtual void
|
|
HandleRouterEvent(RouterEventPtr event) const override;
|
|
};
|
|
|
|
} // namespace tooling
|