make bundle-rc option configurable on snode tld

pull/579/head
Jeff Becker 5 years ago
parent e0892f7d23
commit 986e831579
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -11,12 +11,13 @@ namespace llarp
BaseSession::BaseSession(
const llarp::RouterID& router,
std::function< bool(const llarp_buffer_t&) > writepkt,
AbstractRouter* r, size_t numpaths, size_t hoplen)
AbstractRouter* r, size_t numpaths, size_t hoplen, bool bundleRC)
: llarp::path::Builder(r, r->dht(), numpaths, hoplen)
, m_ExitRouter(router)
, m_WritePacket(writepkt)
, m_Counter(0)
, m_LastUse(0)
, m_BundleRC(bundleRC)
{
r->crypto()->identity_keygen(m_ExitIdentity);
}
@ -281,8 +282,8 @@ namespace llarp
const llarp::RouterID& snodeRouter,
std::function< bool(const llarp_buffer_t&) > writepkt,
AbstractRouter* r, size_t numpaths, size_t hoplen,
bool useRouterSNodeKey)
: BaseSession(snodeRouter, writepkt, r, numpaths, hoplen)
bool useRouterSNodeKey, bool bundleRC)
: BaseSession(snodeRouter, writepkt, r, numpaths, hoplen, bundleRC)
{
if(useRouterSNodeKey)
{

@ -28,7 +28,7 @@ namespace llarp
BaseSession(const llarp::RouterID& exitRouter,
std::function< bool(const llarp_buffer_t&) > writepkt,
AbstractRouter* r, size_t numpaths, size_t hoplen);
AbstractRouter* r, size_t numpaths, size_t hoplen, bool bundleRC);
virtual ~BaseSession();
@ -44,8 +44,7 @@ namespace llarp
bool
ShouldBundleRC() const override
{
// TODO: make configurable
return false;
return m_BundleRC;
}
void
@ -148,6 +147,7 @@ namespace llarp
llarp_time_t m_LastUse;
std::vector< SessionReadyFunc > m_PendingCallbacks;
const bool m_BundleRC;
void
CallPendingCallbacks(bool success);
@ -157,8 +157,8 @@ namespace llarp
{
ExitSession(const llarp::RouterID& snodeRouter,
std::function< bool(const llarp_buffer_t&) > writepkt,
AbstractRouter* r, size_t numpaths, size_t hoplen)
: BaseSession(snodeRouter, writepkt, r, numpaths, hoplen)
AbstractRouter* r, size_t numpaths, size_t hoplen, bool bundleRC)
: BaseSession(snodeRouter, writepkt, r, numpaths, hoplen, bundleRC)
{
}
@ -182,7 +182,7 @@ namespace llarp
SNodeSession(const llarp::RouterID& snodeRouter,
std::function< bool(const llarp_buffer_t&) > writepkt,
AbstractRouter* r, size_t numpaths, size_t hoplen,
bool useRouterSNodeKey = false);
bool useRouterSNodeKey, bool bundleRC);
~SNodeSession() = default;

@ -552,7 +552,7 @@ namespace llarp
other,
std::bind(&ExitEndpoint::QueueSNodePacket, this,
std::placeholders::_1, ip),
GetRouter(), 2, 1, true);
GetRouter(), 2, 1, true, false);
// this is a new service node make an outbound session to them
m_SNodeSessions.emplace(other, session);
}

@ -107,7 +107,7 @@ namespace llarp
exitRouter,
std::bind(&TunEndpoint::QueueInboundPacketForExit, this,
std::placeholders::_1),
router, m_NumPaths, numHops);
router, m_NumPaths, numHops, ShouldBundleRC());
llarp::LogInfo(Name(), " using exit at ", exitRouter);
}
if(k == "local-dns")

@ -984,7 +984,7 @@ namespace llarp
snode,
std::bind(&Endpoint::HandleWriteIPPacket, this, _1,
[themIP]() -> huint32_t { return themIP; }),
m_Router, m_NumPaths, numHops);
m_Router, m_NumPaths, numHops, false, ShouldBundleRC());
m_SNodeSessions.emplace(snode, session);
}
EnsureRouterIsKnown(snode);

Loading…
Cancel
Save