make format

pull/269/head
Ryan Tharp 5 years ago
parent fefb012bf8
commit 4bf4faa956

@ -23,7 +23,9 @@ namespace llarp
{
namespace dht
{
AbstractContext::~AbstractContext() {}
AbstractContext::~AbstractContext()
{
}
Context::Context() : router(nullptr), allowTransit(false)
{

@ -31,18 +31,17 @@ namespace llarp
/// on behalf of whoasked request introset for target from dht router with
/// key askpeer
virtual void
LookupIntroSetRecursive(const service::Address& target,
const Key_t& whoasked, uint64_t whoaskedTX,
const Key_t& askpeer, uint64_t R,
LookupIntroSetRecursive(
const service::Address& target, const Key_t& whoasked,
uint64_t whoaskedTX, const Key_t& askpeer, uint64_t R,
service::IntroSetLookupHandler result = nullptr) = 0;
virtual void
LookupIntroSetIterative(const service::Address& target,
const Key_t& whoasked, uint64_t whoaskedTX,
const Key_t& askpeer,
LookupIntroSetIterative(
const service::Address& target, const Key_t& whoasked,
uint64_t whoaskedTX, const Key_t& askpeer,
service::IntroSetLookupHandler result = nullptr) = 0;
virtual std::set< service::IntroSet >
FindRandomIntroSetsWithTagExcluding(
const service::Tag& tag, size_t max = 2,
@ -63,7 +62,8 @@ namespace llarp
virtual const Key_t&
OurKey() const = 0;
virtual Bucket< RCNode >* Nodes() const = 0;
virtual Bucket< RCNode >*
Nodes() const = 0;
};
struct Context final : public AbstractContext
@ -80,15 +80,15 @@ namespace llarp
/// on behalf of whoasked request introset for target from dht router with
/// key askpeer
void
LookupIntroSetRecursive(const service::Address& target,
const Key_t& whoasked, uint64_t whoaskedTX,
const Key_t& askpeer, uint64_t R,
LookupIntroSetRecursive(
const service::Address& target, const Key_t& whoasked,
uint64_t whoaskedTX, const Key_t& askpeer, uint64_t R,
service::IntroSetLookupHandler result = nullptr) override;
void
LookupIntroSetIterative(const service::Address& target,
const Key_t& whoasked, uint64_t whoaskedTX,
const Key_t& askpeer,
LookupIntroSetIterative(
const service::Address& target, const Key_t& whoasked,
uint64_t whoaskedTX, const Key_t& askpeer,
service::IntroSetLookupHandler result = nullptr) override;
/// on behalf of whoasked request router with public key target from dht
@ -141,7 +141,8 @@ namespace llarp
/// send a dht message to peer, if keepalive is true then keep the session
/// with that peer alive for 10 seconds
void
DHTSendTo(const RouterID& peer, IMessage* msg, bool keepalive = true) override;
DHTSendTo(const RouterID& peer, IMessage* msg,
bool keepalive = true) override;
/// get routers closest to target excluding requester
bool
@ -198,7 +199,11 @@ namespace llarp
std::unique_ptr< Bucket< ISNode > > services;
bool allowTransit;
Bucket< RCNode >* Nodes() const override { return nodes.get(); }
Bucket< RCNode >*
Nodes() const override
{
return nodes.get();
}
const Key_t&
OurKey() const override
@ -207,7 +212,10 @@ namespace llarp
}
llarp::Router*
GetRouter() const override { return router; }
GetRouter() const override
{
return router;
}
TXHolder< service::Address, service::IntroSet, service::Address::Hash >
pendingIntrosetLookups;

@ -11,7 +11,8 @@ namespace llarp
namespace dht
{
LocalRouterLookup::LocalRouterLookup(const PathID_t &path, uint64_t txid,
const RouterID &target, AbstractContext *ctx)
const RouterID &target,
AbstractContext *ctx)
: RecursiveRouterLookup(TXOwner{ctx->OurKey(), txid}, target, ctx,
nullptr)
, localPath(path)

@ -14,7 +14,8 @@ namespace llarp
PathID_t localPath;
LocalServiceAddressLookup(const PathID_t &pathid, uint64_t txid,
const service::Address &addr, AbstractContext *ctx,
const service::Address &addr,
AbstractContext *ctx,
__attribute__((unused)) const Key_t &askpeer);
void

@ -10,7 +10,8 @@ namespace llarp
namespace dht
{
LocalTagLookup::LocalTagLookup(const PathID_t &path, uint64_t txid,
const service::Tag &target, AbstractContext *ctx)
const service::Tag &target,
AbstractContext *ctx)
: TagLookup(TXOwner{ctx->OurKey(), txid}, target, ctx, 0)
, localPath(path)
{

@ -15,7 +15,8 @@ namespace llarp
}
bool
PublishIntroMessage::DecodeKey(const llarp_buffer_t &key, llarp_buffer_t *val)
PublishIntroMessage::DecodeKey(const llarp_buffer_t &key,
llarp_buffer_t *val)
{
bool read = false;
if(llarp_buffer_eq(key, "E"))

@ -9,8 +9,9 @@ namespace llarp
namespace dht
{
ServiceAddressLookup::ServiceAddressLookup(
const TXOwner &asker, const service::Address &addr, AbstractContext *ctx,
uint64_t r, service::IntroSetLookupHandler handler)
const TXOwner &asker, const service::Address &addr,
AbstractContext *ctx, uint64_t r,
service::IntroSetLookupHandler handler)
: TX< service::Address, service::IntroSet >(asker, addr, ctx)
, handleResult(handler)
, R(r)

@ -12,8 +12,8 @@ namespace llarp
struct TagLookup : public TX< service::Tag, service::IntroSet >
{
uint64_t R;
TagLookup(const TXOwner &asker, const service::Tag &tag, AbstractContext *ctx,
uint64_t r)
TagLookup(const TXOwner &asker, const service::Tag &tag,
AbstractContext *ctx, uint64_t r)
: TX< service::Tag, service::IntroSet >(asker, tag, ctx), R(r)
{
}

@ -1057,8 +1057,7 @@ namespace llarp
llarp_buffer_t out(rxFragBody);
// decrypt
if(!Crypto()->xchacha20_alt(out, in, rxKey,
ptr + FragmentHashSize))
if(!Crypto()->xchacha20_alt(out, in, rxKey, ptr + FragmentHashSize))
{
llarp::LogError("failed to decrypt message from ", remoteAddr);
return false;
@ -1083,8 +1082,7 @@ namespace llarp
llarp::LogError("failed to read the rest of the header");
return false;
}
if(length
> (out.sz - (out.cur - out.base)))
if(length > (out.sz - (out.cur - out.base)))
{
// too big length
llarp::LogError("fragment body too big");

@ -279,7 +279,8 @@ namespace llarp
return;
}
// generate hash of hop key for nonce mutation
crypto->shorthash(self->hop->nonceXOR, llarp_buffer_t(self->hop->pathKey));
crypto->shorthash(self->hop->nonceXOR,
llarp_buffer_t(self->hop->pathKey));
using namespace std::placeholders;
if(self->record.work
&& self->record.work->IsValid(

@ -23,8 +23,8 @@ namespace llarp
struct in6_addr netmask;
PubKey pubkey;
ExitInfo(const PubKey &pk, const nuint32_t &ipv4_exit) : IBEncodeMessage(),
pubkey(pk)
ExitInfo(const PubKey &pk, const nuint32_t &ipv4_exit)
: IBEncodeMessage(), pubkey(pk)
{
memset(address.s6_addr, 0, 16);
address.s6_addr[11] = 0xff;
@ -37,8 +37,8 @@ namespace llarp
{
}
ExitInfo(const ExitInfo &other) : IBEncodeMessage(other.version),
pubkey(other.pubkey)
ExitInfo(const ExitInfo &other)
: IBEncodeMessage(other.version), pubkey(other.pubkey)
{
memcpy(address.s6_addr, other.address.s6_addr, 16);
memcpy(netmask.s6_addr, other.netmask.s6_addr, 16);

@ -155,8 +155,7 @@ namespace llarp
IHopHandler*
PathContext::GetByUpstream(const RouterID& remote, const PathID_t& id)
{
auto own = MapGet(
m_OurPaths, id,
auto own = MapGet(m_OurPaths, id,
[](__attribute__((unused)) const PathSet* s) -> bool {
// TODO: is this right?
return true;
@ -167,8 +166,7 @@ namespace llarp
if(own)
return own;
return MapGet(
m_TransitPaths, id,
return MapGet(m_TransitPaths, id,
[remote](const std::shared_ptr< TransitHop >& hop) -> bool {
return hop->info.upstream == remote;
},
@ -191,8 +189,7 @@ namespace llarp
IHopHandler*
PathContext::GetByDownstream(const RouterID& remote, const PathID_t& id)
{
return MapGet(
m_TransitPaths, id,
return MapGet(m_TransitPaths, id,
[remote](const std::shared_ptr< TransitHop >& hop) -> bool {
return hop->info.downstream == remote;
},

@ -18,7 +18,8 @@ namespace llarp
}
bool
PathConfirmMessage::DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val)
PathConfirmMessage::DecodeKey(const llarp_buffer_t& key,
llarp_buffer_t* val)
{
bool read = false;
if(!BEncodeMaybeReadDictInt("L", pathLifetime, read, key, val))

@ -10,7 +10,8 @@ namespace llarp
}
bool
PathLatencyMessage::DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val)
PathLatencyMessage::DecodeKey(const llarp_buffer_t& key,
llarp_buffer_t* val)
{
bool read = false;
if(!BEncodeMaybeReadDictInt("L", L, read, key, val))

@ -16,7 +16,8 @@ namespace llarp
}
bool
PathTransferMessage::DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val)
PathTransferMessage::DecodeKey(const llarp_buffer_t& key,
llarp_buffer_t* val)
{
bool read = false;
if(!BEncodeMaybeReadDictEntry("P", P, read, key, val))

Loading…
Cancel
Save