make bundling rc in path builds configurable on runtime

pull/531/head
Jeff Becker 5 years ago
parent 94eb37d490
commit 57dc6cc965
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -32,6 +32,13 @@ namespace llarp
util::StatusObject
ExtractStatus() const override;
bool
ShouldBundleRC() const override
{
// TODO: make configurable
return false;
}
void
HandlePathDied(llarp::path::Path* p) override;

@ -54,6 +54,7 @@ namespace llarp
// current hop
auto& hop = ctx->path->hops[ctx->idx];
auto& frame = ctx->LRCM.frames[ctx->idx];
// generate key
ctx->crypto->encryption_keygen(hop.commkey);
hop.nonce.Randomize();
@ -80,8 +81,9 @@ namespace llarp
else
{
hop.upstream = ctx->path->hops[ctx->idx].rc.pubkey;
record.nextRC =
std::make_unique< RouterContact >(ctx->path->hops[ctx->idx].rc);
if(ctx->pathset->ShouldBundleRC())
record.nextRC =
std::make_unique< RouterContact >(ctx->path->hops[ctx->idx].rc);
}
// build record

@ -48,6 +48,10 @@ namespace llarp
virtual bool
ShouldBuildMore(llarp_time_t now) const override;
/// should we bundle RCs in builds?
virtual bool
ShouldBundleRC() const = 0;
/// return true if we hit our soft limit for building paths too fast
bool
BuildCooldownHit(llarp_time_t now) const;

@ -390,7 +390,7 @@ namespace llarp
EnsureEncryptionKey();
bool
ConnectionToRouterAllowed(const RouterID &router) const;
ConnectionToRouterAllowed(const RouterID &router) const override;
bool
SaveRC();

@ -12,7 +12,7 @@
#include <router/abstractrouter.hpp>
#include <service/protocol.hpp>
#include <util/logic.hpp>
#include <util/str.hpp>
#include <util/buffer.hpp>
namespace llarp
@ -57,6 +57,10 @@ namespace llarp
if(val > 0)
m_MinPathLatency = val;
}
if(k == "bundle-rc")
{
m_BundleRC = IsTrueValue(v.c_str());
}
return true;
}
@ -812,6 +816,12 @@ namespace llarp
self->m_IsolatedLogic);
}
bool
Endpoint::ShouldBundleRC() const
{
return m_BundleRC;
}
void
Endpoint::PutNewOutboundContext(const llarp::service::IntroSet& introset)
{

@ -214,6 +214,9 @@ namespace llarp
using PendingBufferQueue = std::queue< PendingBuffer >;
bool
ShouldBundleRC() const override;
struct SendContext
{
SendContext(const ServiceInfo& ident, const Introduction& intro,
@ -280,6 +283,12 @@ namespace llarp
util::StatusObject
ExtractStatus() const override;
bool
ShouldBundleRC() const override
{
return m_Endpoint->ShouldBundleRC();
}
bool
Stop() override;
@ -494,6 +503,7 @@ namespace llarp
std::string m_Keyfile;
std::string m_Name;
std::string m_NetNS;
bool m_BundleRC = false;
using PendingTraffic =
std::unordered_map< Address, PendingBufferQueue, Address::Hash >;

Loading…
Cancel
Save