From 4bf4faa95673a57d86e7ed2805c8c5da7e931633 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Mon, 4 Feb 2019 16:41:33 -0800 Subject: [PATCH] make format --- llarp/dht/context.cpp | 4 +- llarp/dht/context.hpp | 50 ++++++++++++++----------- llarp/dht/localrouterlookup.cpp | 3 +- llarp/dht/localserviceaddresslookup.hpp | 3 +- llarp/dht/localtaglookup.cpp | 3 +- llarp/dht/messages/findintro.cpp | 2 +- llarp/dht/messages/findintro.hpp | 2 +- llarp/dht/messages/findrouter.hpp | 2 +- llarp/dht/messages/gotintro.hpp | 2 +- llarp/dht/messages/gotrouter.hpp | 2 +- llarp/dht/messages/pubintro.cpp | 3 +- llarp/dht/messages/pubintro.hpp | 2 +- llarp/dht/serviceaddresslookup.cpp | 5 ++- llarp/dht/taglookup.hpp | 4 +- llarp/dns/dns.hpp | 2 +- llarp/handlers/exit.hpp | 2 +- llarp/link/utp.cpp | 6 +-- llarp/messages/dht.hpp | 2 +- llarp/messages/dht_immediate.hpp | 2 +- llarp/messages/exit.hpp | 10 ++--- llarp/messages/path_confirm.hpp | 2 +- llarp/messages/path_latency.hpp | 2 +- llarp/messages/path_transfer.hpp | 2 +- llarp/messages/relay.hpp | 4 +- llarp/messages/relay_commit.cpp | 5 ++- llarp/net/exit_info.cpp | 2 +- llarp/net/exit_info.hpp | 8 ++-- llarp/path/path.cpp | 47 +++++++++++------------ llarp/pow.hpp | 2 +- llarp/profiling.hpp | 4 +- llarp/router_contact.hpp | 2 +- llarp/routing/dht_message.cpp | 2 +- llarp/routing/path_confirm.cpp | 3 +- llarp/routing/path_latency.cpp | 3 +- llarp/routing/path_transfer.cpp | 3 +- llarp/service/Intro.cpp | 2 +- llarp/service/Intro.hpp | 2 +- llarp/service/IntroSet.hpp | 2 +- llarp/util/encode.hpp | 2 +- 39 files changed, 112 insertions(+), 98 deletions(-) diff --git a/llarp/dht/context.cpp b/llarp/dht/context.cpp index 020633e42..02fc83d82 100644 --- a/llarp/dht/context.cpp +++ b/llarp/dht/context.cpp @@ -23,7 +23,9 @@ namespace llarp { namespace dht { - AbstractContext::~AbstractContext() {} + AbstractContext::~AbstractContext() + { + } Context::Context() : router(nullptr), allowTransit(false) { diff --git a/llarp/dht/context.hpp b/llarp/dht/context.hpp index 82961f1aa..918b51172 100644 --- a/llarp/dht/context.hpp +++ b/llarp/dht/context.hpp @@ -31,17 +31,16 @@ 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, - service::IntroSetLookupHandler result = nullptr) = 0; + 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, - service::IntroSetLookupHandler result = nullptr) = 0; - + 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( @@ -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,16 +80,16 @@ 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, - service::IntroSetLookupHandler result = nullptr) override; + 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, - service::IntroSetLookupHandler result = nullptr) override; + 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 /// router with key askpeer @@ -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; diff --git a/llarp/dht/localrouterlookup.cpp b/llarp/dht/localrouterlookup.cpp index f5f806522..8cd1eed4c 100644 --- a/llarp/dht/localrouterlookup.cpp +++ b/llarp/dht/localrouterlookup.cpp @@ -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) diff --git a/llarp/dht/localserviceaddresslookup.hpp b/llarp/dht/localserviceaddresslookup.hpp index 63a054efd..5f71cf212 100644 --- a/llarp/dht/localserviceaddresslookup.hpp +++ b/llarp/dht/localserviceaddresslookup.hpp @@ -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 diff --git a/llarp/dht/localtaglookup.cpp b/llarp/dht/localtaglookup.cpp index 7d7c53fcd..56fed5c36 100644 --- a/llarp/dht/localtaglookup.cpp +++ b/llarp/dht/localtaglookup.cpp @@ -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) { diff --git a/llarp/dht/messages/findintro.cpp b/llarp/dht/messages/findintro.cpp index b793665b4..9c0f6aed2 100644 --- a/llarp/dht/messages/findintro.cpp +++ b/llarp/dht/messages/findintro.cpp @@ -12,7 +12,7 @@ namespace llarp } bool - FindIntroMessage::DecodeKey(const llarp_buffer_t &k, llarp_buffer_t* val) + FindIntroMessage::DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val) { bool read = false; diff --git a/llarp/dht/messages/findintro.hpp b/llarp/dht/messages/findintro.hpp index 774a9d561..f09229462 100644 --- a/llarp/dht/messages/findintro.hpp +++ b/llarp/dht/messages/findintro.hpp @@ -51,7 +51,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; bool HandleMessage( diff --git a/llarp/dht/messages/findrouter.hpp b/llarp/dht/messages/findrouter.hpp index 1a917ae53..0bbb0da42 100644 --- a/llarp/dht/messages/findrouter.hpp +++ b/llarp/dht/messages/findrouter.hpp @@ -31,7 +31,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; virtual bool HandleMessage( diff --git a/llarp/dht/messages/gotintro.hpp b/llarp/dht/messages/gotintro.hpp index 50c8fb88f..5ae6c9285 100644 --- a/llarp/dht/messages/gotintro.hpp +++ b/llarp/dht/messages/gotintro.hpp @@ -40,7 +40,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; virtual bool HandleMessage( diff --git a/llarp/dht/messages/gotrouter.hpp b/llarp/dht/messages/gotrouter.hpp index de00b4d53..449cbfdf1 100644 --- a/llarp/dht/messages/gotrouter.hpp +++ b/llarp/dht/messages/gotrouter.hpp @@ -38,7 +38,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; virtual bool HandleMessage( diff --git a/llarp/dht/messages/pubintro.cpp b/llarp/dht/messages/pubintro.cpp index 173925f80..740d09136 100644 --- a/llarp/dht/messages/pubintro.cpp +++ b/llarp/dht/messages/pubintro.cpp @@ -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")) diff --git a/llarp/dht/messages/pubintro.hpp b/llarp/dht/messages/pubintro.hpp index d2b794bfa..d9348c913 100644 --- a/llarp/dht/messages/pubintro.hpp +++ b/llarp/dht/messages/pubintro.hpp @@ -35,7 +35,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; virtual bool HandleMessage( diff --git a/llarp/dht/serviceaddresslookup.cpp b/llarp/dht/serviceaddresslookup.cpp index 5017842f1..571c1c2cd 100644 --- a/llarp/dht/serviceaddresslookup.cpp +++ b/llarp/dht/serviceaddresslookup.cpp @@ -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) diff --git a/llarp/dht/taglookup.hpp b/llarp/dht/taglookup.hpp index 2fbfaf537..e028af7e5 100644 --- a/llarp/dht/taglookup.hpp +++ b/llarp/dht/taglookup.hpp @@ -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) { } diff --git a/llarp/dns/dns.hpp b/llarp/dns/dns.hpp index 55c34bcc9..aceef8fa6 100644 --- a/llarp/dns/dns.hpp +++ b/llarp/dns/dns.hpp @@ -7,7 +7,7 @@ namespace llarp { namespace dns { - constexpr uint16_t qTypeAAAA = 28; + constexpr uint16_t qTypeAAAA = 28; constexpr uint16_t qTypeTXT = 16; constexpr uint16_t qTypeMX = 15; constexpr uint16_t qTypePTR = 12; diff --git a/llarp/handlers/exit.hpp b/llarp/handlers/exit.hpp index ad2ea3c75..ef9cc72af 100644 --- a/llarp/handlers/exit.hpp +++ b/llarp/handlers/exit.hpp @@ -114,7 +114,7 @@ namespace llarp ObtainServiceNodeIP(const RouterID& router); bool - QueueSNodePacket(const llarp_buffer_t & buf, huint32_t from); + QueueSNodePacket(const llarp_buffer_t& buf, huint32_t from); void MarkIPActive(huint32_t ip); diff --git a/llarp/link/utp.cpp b/llarp/link/utp.cpp index bada8d873..fe463ca23 100644 --- a/llarp/link/utp.cpp +++ b/llarp/link/utp.cpp @@ -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"); diff --git a/llarp/messages/dht.hpp b/llarp/messages/dht.hpp index 90c6c3648..be61d9ffc 100644 --- a/llarp/messages/dht.hpp +++ b/llarp/messages/dht.hpp @@ -18,7 +18,7 @@ namespace llarp ~DHTMessage(); bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; bool BEncode(llarp_buffer_t* buf) const override; diff --git a/llarp/messages/dht_immediate.hpp b/llarp/messages/dht_immediate.hpp index 7123a86f1..00c0cb4e6 100644 --- a/llarp/messages/dht_immediate.hpp +++ b/llarp/messages/dht_immediate.hpp @@ -19,7 +19,7 @@ namespace llarp std::vector< std::unique_ptr< llarp::dht::IMessage > > msgs; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool BEncode(llarp_buffer_t* buf) const override; diff --git a/llarp/messages/exit.hpp b/llarp/messages/exit.hpp index 44e187c4e..f9b223e5b 100644 --- a/llarp/messages/exit.hpp +++ b/llarp/messages/exit.hpp @@ -53,7 +53,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool HandleMessage(IMessageHandler* h, llarp::Router* r) const override; @@ -86,7 +86,7 @@ namespace llarp Verify(llarp::Crypto* c, const llarp::PubKey& pk) const; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool HandleMessage(IMessageHandler* h, llarp::Router* r) const override; @@ -140,7 +140,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool HandleMessage(IMessageHandler* h, llarp::Router* r) const override; @@ -182,7 +182,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool HandleMessage(IMessageHandler* h, llarp::Router* r) const override; @@ -217,7 +217,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool HandleMessage(IMessageHandler* h, llarp::Router* r) const override; diff --git a/llarp/messages/path_confirm.hpp b/llarp/messages/path_confirm.hpp index 89cf0bf87..021cc31e6 100644 --- a/llarp/messages/path_confirm.hpp +++ b/llarp/messages/path_confirm.hpp @@ -19,7 +19,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; bool HandleMessage(IMessageHandler* h, llarp::Router* r) const override; diff --git a/llarp/messages/path_latency.hpp b/llarp/messages/path_latency.hpp index e8f4b9028..aae47e955 100644 --- a/llarp/messages/path_latency.hpp +++ b/llarp/messages/path_latency.hpp @@ -17,7 +17,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; void Clear() override diff --git a/llarp/messages/path_transfer.hpp b/llarp/messages/path_transfer.hpp index c4dcba9c3..97b333026 100644 --- a/llarp/messages/path_transfer.hpp +++ b/llarp/messages/path_transfer.hpp @@ -25,7 +25,7 @@ namespace llarp ~PathTransferMessage(); bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override; bool BEncode(llarp_buffer_t* buf) const override; diff --git a/llarp/messages/relay.hpp b/llarp/messages/relay.hpp index 26aa7c795..8d236e489 100644 --- a/llarp/messages/relay.hpp +++ b/llarp/messages/relay.hpp @@ -21,7 +21,7 @@ namespace llarp ~RelayUpstreamMessage(); bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool BEncode(llarp_buffer_t* buf) const override; @@ -43,7 +43,7 @@ namespace llarp ~RelayDownstreamMessage(); bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool BEncode(llarp_buffer_t* buf) const override; diff --git a/llarp/messages/relay_commit.cpp b/llarp/messages/relay_commit.cpp index 031afdc4c..1ea9bdc9e 100644 --- a/llarp/messages/relay_commit.cpp +++ b/llarp/messages/relay_commit.cpp @@ -279,11 +279,12 @@ 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( - std::bind(&Crypto::shorthash, crypto, _1, _2), now)) + std::bind(&Crypto::shorthash, crypto, _1, _2), now)) { llarp::LogDebug("LRCM extended lifetime by ", self->record.work->extendedLifetime, " seconds for ", diff --git a/llarp/net/exit_info.cpp b/llarp/net/exit_info.cpp index e9f7acf57..89d6f1798 100644 --- a/llarp/net/exit_info.cpp +++ b/llarp/net/exit_info.cpp @@ -68,7 +68,7 @@ namespace llarp } bool - ExitInfo::DecodeKey(const llarp_buffer_t &k, llarp_buffer_t* buf) + ExitInfo::DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* buf) { bool read = false; if(!BEncodeMaybeReadDictEntry("k", pubkey, read, k, buf)) diff --git a/llarp/net/exit_info.hpp b/llarp/net/exit_info.hpp index 356c62c01..51a6a59e5 100644 --- a/llarp/net/exit_info.hpp +++ b/llarp/net/exit_info.hpp @@ -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); diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index 6311542cb..1818b9111 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -155,26 +155,24 @@ namespace llarp IHopHandler* PathContext::GetByUpstream(const RouterID& remote, const PathID_t& id) { - auto own = MapGet( - m_OurPaths, id, - [](__attribute__((unused)) const PathSet* s) -> bool { - // TODO: is this right? - return true; - }, - [remote, id](PathSet* p) -> IHopHandler* { - return p->GetByUpstream(remote, id); - }); + auto own = MapGet(m_OurPaths, id, + [](__attribute__((unused)) const PathSet* s) -> bool { + // TODO: is this right? + return true; + }, + [remote, id](PathSet* p) -> IHopHandler* { + return p->GetByUpstream(remote, id); + }); if(own) return own; - return MapGet( - m_TransitPaths, id, - [remote](const std::shared_ptr< TransitHop >& hop) -> bool { - return hop->info.upstream == remote; - }, - [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { - return h.get(); - }); + return MapGet(m_TransitPaths, id, + [remote](const std::shared_ptr< TransitHop >& hop) -> bool { + return hop->info.upstream == remote; + }, + [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { + return h.get(); + }); } bool @@ -191,14 +189,13 @@ namespace llarp IHopHandler* PathContext::GetByDownstream(const RouterID& remote, const PathID_t& id) { - return MapGet( - m_TransitPaths, id, - [remote](const std::shared_ptr< TransitHop >& hop) -> bool { - return hop->info.downstream == remote; - }, - [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { - return h.get(); - }); + return MapGet(m_TransitPaths, id, + [remote](const std::shared_ptr< TransitHop >& hop) -> bool { + return hop->info.downstream == remote; + }, + [](const std::shared_ptr< TransitHop >& h) -> IHopHandler* { + return h.get(); + }); } PathSet* diff --git a/llarp/pow.hpp b/llarp/pow.hpp index 9138fbf1c..efc8f8290 100644 --- a/llarp/pow.hpp +++ b/llarp/pow.hpp @@ -21,7 +21,7 @@ namespace llarp IsValid(shorthash_func hashfunc, llarp_time_t now) const; bool - DecodeKey(const llarp_buffer_t &k, llarp_buffer_t* val) override; + DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val) override; bool BEncode(llarp_buffer_t* buf) const override; diff --git a/llarp/profiling.hpp b/llarp/profiling.hpp index e92ba07d5..d926c32f0 100644 --- a/llarp/profiling.hpp +++ b/llarp/profiling.hpp @@ -26,7 +26,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &k, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* buf) override; bool IsGood(uint64_t chances) const; @@ -55,7 +55,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &k, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* buf) override; bool Load(const char* fname); diff --git a/llarp/router_contact.hpp b/llarp/router_contact.hpp index 2f491632e..397550e96 100644 --- a/llarp/router_contact.hpp +++ b/llarp/router_contact.hpp @@ -191,7 +191,7 @@ namespace llarp }; using RouterLookupHandler = - std::function< void(const std::vector< RouterContact >&) >; + std::function< void(const std::vector< RouterContact > &) >; } // namespace llarp #endif diff --git a/llarp/routing/dht_message.cpp b/llarp/routing/dht_message.cpp index d4d3821ad..dbaa9b8e4 100644 --- a/llarp/routing/dht_message.cpp +++ b/llarp/routing/dht_message.cpp @@ -11,7 +11,7 @@ namespace llarp } bool - DHTMessage::DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* val) + DHTMessage::DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) { llarp::dht::Key_t from; from.Zero(); diff --git a/llarp/routing/path_confirm.cpp b/llarp/routing/path_confirm.cpp index 20c5c7271..388a13646 100644 --- a/llarp/routing/path_confirm.cpp +++ b/llarp/routing/path_confirm.cpp @@ -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)) diff --git a/llarp/routing/path_latency.cpp b/llarp/routing/path_latency.cpp index a8055d02f..845690369 100644 --- a/llarp/routing/path_latency.cpp +++ b/llarp/routing/path_latency.cpp @@ -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)) diff --git a/llarp/routing/path_transfer.cpp b/llarp/routing/path_transfer.cpp index 14202d82f..b9c265e5e 100644 --- a/llarp/routing/path_transfer.cpp +++ b/llarp/routing/path_transfer.cpp @@ -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)) diff --git a/llarp/service/Intro.cpp b/llarp/service/Intro.cpp index 220c8da89..ab23da307 100644 --- a/llarp/service/Intro.cpp +++ b/llarp/service/Intro.cpp @@ -9,7 +9,7 @@ namespace llarp } bool - Introduction::DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) + Introduction::DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) { bool read = false; if(!BEncodeMaybeReadDictEntry("k", router, read, key, buf)) diff --git a/llarp/service/Intro.hpp b/llarp/service/Intro.hpp index cfbc039ac..23c7f91cf 100644 --- a/llarp/service/Intro.hpp +++ b/llarp/service/Intro.hpp @@ -56,7 +56,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; void Clear(); diff --git a/llarp/service/IntroSet.hpp b/llarp/service/IntroSet.hpp index 541537f48..f781d38a7 100644 --- a/llarp/service/IntroSet.hpp +++ b/llarp/service/IntroSet.hpp @@ -149,7 +149,7 @@ namespace llarp BEncode(llarp_buffer_t* buf) const override; bool - DecodeKey(const llarp_buffer_t &key, llarp_buffer_t* buf) override; + DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override; bool Verify(llarp::Crypto* crypto, llarp_time_t now) const; diff --git a/llarp/util/encode.hpp b/llarp/util/encode.hpp index ec024749d..75d1e1775 100644 --- a/llarp/util/encode.hpp +++ b/llarp/util/encode.hpp @@ -34,7 +34,7 @@ namespace llarp static size_t Base32DecodeSize(size_t sz) { - return DecodeSize<5, 8>(sz); + return DecodeSize< 5, 8 >(sz); } template < typename Stack, typename V >