more also run make format

pull/6/head^2
Jeff Becker 6 years ago
parent 4b748a29f3
commit 6945fe53a5

@ -21,6 +21,7 @@ TESTNET_ROOT=$(REPO)/testnet_tmp
TESTNET_CONF=$(TESTNET_ROOT)/supervisor.conf
TESTNET_LOG=$(TESTNET_ROOT)/testnet.log
TESTNET_EXE=$(REPO)/lokinet
TESTNET_CLIENTS ?= 50
TESTNET_SERVERS ?= 50
TESTNET_DEBUG ?= 0
@ -72,12 +73,12 @@ testnet-configure: clean
testnet-build: testnet-configure
ninja
$(TESTNET_ROOT): testnet-build
$(TESTNET_EXE): testnet-build
cp -f $(REPO)/llarpd $(TESTNET_EXE)
testnet: $(TESTNET_ROOT)
testnet: $(TESTNET_EXE)
mkdir -p $(TESTNET_ROOT)
python3 contrib/testnet/genconf.py --bin=$(REPO)/llarpd --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF)
python3 contrib/testnet/genconf.py --bin=$(TESTNET_EXE) --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF)
LLARP_DEBUG=$(TESTNET_DEBUG) supervisord -n -d $(TESTNET_ROOT) -l $(TESTNET_LOG) -c $(TESTNET_CONF)
test: debug-configure
@ -86,3 +87,14 @@ test: debug-configure
format:
clang-format -i $$(find daemon llarp include | grep -E '\.[h,c](pp)?$$')
fuzz-configure: clean
cmake -GNinja -DCMAKE_BUILD_TYPE=Fuzz -DCMAKE_C_COMPILER=afl-gcc -DCMAKE_CXX_COMPILER=afl-g++
fuzz-build: fuzz-configure
ninja
fuzz: fuzz-build
$(EXE)

@ -9,72 +9,74 @@
#include <llarp/version.h>
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
/// llarp application context for C api
struct llarp_main;
/// llarp application context for C api
struct llarp_main;
/// initialize application context and load config
struct llarp_main *
llarp_main_init(const char *fname, bool multiProcess);
/// initialize application context and load config
struct llarp_main *
llarp_main_init(const char *fname, bool multiProcess);
/// handle signal for main context
void
llarp_main_signal(struct llarp_main *ptr, int sig);
/// handle signal for main context
void
llarp_main_signal(struct llarp_main *ptr, int sig);
/// setup main context
int
llarp_main_setup(struct llarp_main *ptr);
/// setup main context
int
llarp_main_setup(struct llarp_main *ptr);
/// run main context
int
llarp_main_run(struct llarp_main *ptr);
/// run main context
int
llarp_main_run(struct llarp_main *ptr);
void
llarp_main_abort(struct llarp_main *ptr);
void
llarp_main_abort(struct llarp_main *ptr);
/// load nodeDB into memory
int
llarp_main_loadDatabase(struct llarp_main *ptr);
/// load nodeDB into memory
int
llarp_main_loadDatabase(struct llarp_main *ptr);
/// iterator on nodedb entries
int
llarp_main_iterateDatabase(struct llarp_main *ptr, struct llarp_nodedb_iter i);
/// iterator on nodedb entries
int
llarp_main_iterateDatabase(struct llarp_main *ptr,
struct llarp_nodedb_iter i);
/// put RC into nodeDB
bool
llarp_main_putDatabase(struct llarp_main *ptr, struct llarp_rc *rc);
/// put RC into nodeDB
bool
llarp_main_putDatabase(struct llarp_main *ptr, struct llarp_rc *rc);
/// get RC from nodeDB
struct llarp_rc *
llarp_main_getDatabase(struct llarp_main *ptr, byte_t *pk);
/// get RC from nodeDB
struct llarp_rc *
llarp_main_getDatabase(struct llarp_main *ptr, byte_t *pk);
// fwd declr
struct check_online_request;
// fwd declr
struct check_online_request;
/// check_online_request hook definition
typedef void (*check_online_request_hook_func)(struct check_online_request *);
/// check_online_request hook definition
typedef void (*check_online_request_hook_func)(struct check_online_request *);
struct check_online_request
{
struct llarp_main *ptr;
struct llarp_router_lookup_job *job;
bool online;
size_t nodes;
bool first;
check_online_request_hook_func hook;
};
/// get RC from DHT
void
llarp_main_queryDHT(struct check_online_request *request);
struct llarp_rc *
llarp_main_getLocalRC(struct llarp_main *ptr);
void
llarp_main_free(struct llarp_main *ptr);
struct check_online_request
{
struct llarp_main *ptr;
struct llarp_router_lookup_job *job;
bool online;
size_t nodes;
bool first;
check_online_request_hook_func hook;
};
/// get RC from DHT
void
llarp_main_queryDHT(struct check_online_request *request);
struct llarp_rc *
llarp_main_getLocalRC(struct llarp_main *ptr);
void
llarp_main_free(struct llarp_main *ptr);
#ifdef __cplusplus
}

@ -22,20 +22,20 @@ namespace llarp
AlignedBuffer(const AlignedBuffer& other)
{
for(size_t idx = 0; idx < (sz / 8); ++idx)
l[idx] = other.l[idx];
l[idx] = other.l[idx];
}
AlignedBuffer(const byte_t* data)
{
for(size_t idx = 0; idx < sz; ++idx)
b[idx] = data[idx];
b[idx] = data[idx];
}
AlignedBuffer&
operator=(const byte_t* data)
{
for(size_t idx = 0; idx < sz; ++idx)
b[idx] = data[idx];
b[idx] = data[idx];
return *this;
}
@ -80,7 +80,7 @@ namespace llarp
Fill(byte_t f)
{
for(size_t idx = 0; idx < sz; ++idx)
b[idx] = f;
b[idx] = f;
}
bool
@ -95,7 +95,7 @@ namespace llarp
Zero()
{
for(size_t idx = 0; idx * 8 < sz; ++idx)
l[idx] = 0;
l[idx] = 0;
}
void

@ -72,6 +72,6 @@ namespace llarp
BucketStorage_t nodes;
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -39,6 +39,11 @@ namespace llarp
llarp_router_lookup_job* job = nullptr,
bool iterative = false, std::set< Key_t > excludes = {});
void
LookupIntroSet(const service::Address& addr, const Key_t& whoasked,
uint64_t whoaskedTX, const Key_t& askpeer,
bool interative = false, std::set< Key_t > excludes = {});
void
LookupRouterViaJob(llarp_router_lookup_job* job);
@ -115,12 +120,12 @@ namespace llarp
memcpy(&sz2, &o.node[0], sizeof(std::size_t));
return o.txid ^ (sz2 << 1);
}
};
}; // namespace dht
std::unordered_map< TXOwner, SearchJob, TXOwnerHash > pendingTX;
Key_t ourKey;
};
} // namespace dht
}; // namespace llarp
} // namespace dht
} // namespace llarp
struct llarp_dht_context

@ -19,6 +19,6 @@ namespace llarp
return (us ^ left) < (us ^ right);
};
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -21,7 +21,7 @@ namespace llarp
{
Key_t dist;
for(size_t idx = 0; idx < 4; ++idx)
dist.l[idx] = l[idx] ^ other.l[idx];
dist.l[idx] = l[idx] ^ other.l[idx];
return dist;
}
@ -31,7 +31,7 @@ namespace llarp
return memcmp(data_l(), other.data_l(), 32) < 0;
}
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -35,7 +35,7 @@ namespace llarp
bool
DecodeMesssageList(const Key_t& from, llarp_buffer_t* buf,
std::vector< IMessage* >& dst, bool relayed = false);
}
}
} // namespace dht
} // namespace llarp
#endif

@ -33,7 +33,10 @@ namespace llarp
struct RelayedFindIntroMessage : public FindIntroMessage
{
RelayedFindIntroMessage();
RelayedFindIntroMessage() : FindIntroMessage({})
{
}
~RelayedFindIntroMessage();
bool

@ -49,6 +49,6 @@ namespace llarp
HandleMessage(llarp_dht_context* ctx,
std::vector< IMessage* >& replies) const;
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -38,6 +38,6 @@ namespace llarp
uint64_t txid = 0;
uint64_t version = 0;
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -35,6 +35,6 @@ namespace llarp
HandleMessage(llarp_dht_context* ctx,
std::vector< IMessage* >& replies) const;
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -43,7 +43,7 @@ namespace llarp
other.A.CalculateAddress(ID);
}
};
}
}
} // namespace dht
} // namespace llarp
#endif

@ -12,9 +12,11 @@ namespace llarp
{
namespace dht
{
/// TODO: this should be made into a templated type
struct SearchJob
{
const static uint64_t JobTimeout = 30000;
typedef std::function< void(const llarp::service::IntroSet*) >
IntroSetHookFunc;
SearchJob();

@ -26,7 +26,7 @@ extern "C"
struct dns_client_request;
typedef void (*resolve_dns_hook_func)(dns_client_request *request,
typedef void (*resolve_dns_hook_func)(struct dns_client_request *request,
struct sockaddr *);
struct dns_client_request

@ -46,10 +46,9 @@ struct frame_state
std::unordered_map< uint64_t, transit_message * > tx;
typedef std::queue< sendbuf_t * > sendqueue_t;
typedef llarp::util::CoDelQueue< InboundMessage *, InboundMessage::GetTime,
InboundMessage::PutTime,
llarp::util::DummyMutex,
llarp::util::DummyLock >
typedef llarp::util::CoDelQueue<
InboundMessage *, InboundMessage::GetTime, InboundMessage::PutTime,
llarp::util::DummyMutex, llarp::util::DummyLock >
recvqueue_t;
llarp_link_session *parent = nullptr;

@ -112,19 +112,19 @@ struct llarp_link
TickSessions()
{
auto now = llarp_time_now_ms();
std::set< llarp::Addr > remove;
{
lock_t lock(m_sessions_Mutex);
std::set< llarp::Addr > remove;
for(auto &itr : m_sessions)
{
llarp_link_session *s = itr.second;
if(s && s->Tick(now))
remove.insert(itr.first);
}
for(const auto &addr : remove)
RemoveSessionByAddr(addr);
}
for(const auto &addr : remove)
RemoveSessionByAddr(addr);
}
static bool
@ -166,7 +166,7 @@ struct llarp_link
}
llarp_link_session *
create_session(llarp::Addr src)
create_session(const llarp::Addr &src)
{
return new llarp_link_session(this, seckey, src);
}
@ -209,17 +209,31 @@ struct llarp_link
}
}
/// safe iterate sessions
void
iterate_sessions(std::function< bool(llarp_link_session *) > visitor)
{
std::list< llarp_link_session * > slist;
{
lock_t lock(m_sessions_Mutex);
for(const auto &itr : m_sessions)
{
slist.push_back(itr.second);
}
}
for(auto s : slist)
if(!visitor(s))
return;
}
static void
handle_logic_pump(void *user)
{
llarp_link *self = static_cast< llarp_link * >(user);
lock_t lock(self->m_sessions_Mutex);
auto itr = self->m_sessions.begin();
while(itr != self->m_sessions.end())
{
itr->second->TickLogic();
++itr;
}
self->iterate_sessions([](llarp_link_session *s) -> bool {
s->TickLogic();
return true;
});
}
void
@ -231,6 +245,7 @@ struct llarp_link
void
RemoveSessionByAddr(const llarp::Addr &addr)
{
lock_t lock(m_sessions_Mutex);
auto itr = m_sessions.find(addr);
if(itr != m_sessions.end())
{
@ -353,8 +368,8 @@ struct llarp_link
return false;
}
llarp::LogDebug("configure link ifname=", ifname, " af=", af, " port=",
port);
llarp::LogDebug("configure link ifname=", ifname, " af=", af,
" port=", port);
// bind
sockaddr_in ip4addr;
sockaddr_in6 ip6addr;
@ -436,22 +451,6 @@ struct llarp_link
return true;
}
void
iter_sessions(llarp_link_session_iter iter)
{
auto sz = m_sessions.size();
if(sz)
{
llarp::LogDebug("we have ", sz, "sessions");
iter.link = this;
// TODO: race condition with cleanup timer
for(auto &item : m_sessions)
if(item.second)
if(!iter.visit(&iter, item.second))
return;
}
}
bool
try_establish(struct llarp_link_establish_job *job)
{

@ -34,6 +34,7 @@ struct llarp_link_session
bool
has_timed_out();
bool
timedout(llarp_time_t now, llarp_time_t timeout = SESSION_TIMEOUT);
@ -93,10 +94,9 @@ struct llarp_link_session
llarp_router *
Router();
llarp_udp_io *udp;
llarp_crypto *crypto;
llarp_async_iwp *iwp;
llarp_logic *logic;
llarp_udp_io *udp = nullptr;
llarp_crypto *crypto = nullptr;
llarp_async_iwp *iwp = nullptr;
llarp_link *serv = nullptr;

@ -30,6 +30,11 @@ namespace llarp
return idx;
}
};
operator const dht::Key_t() const
{
return dht::Key_t(data());
}
};
} // namespace service

@ -18,6 +18,6 @@ namespace llarp
bool
Load(const std::string& fname);
};
}
}
} // namespace service
} // namespace llarp
#endif

@ -25,6 +25,6 @@ namespace llarp
llarp_router *m_Router;
std::unordered_map< std::string, Endpoint * > m_Endpoints;
};
}
}
} // namespace service
} // namespace llarp
#endif

@ -9,6 +9,6 @@ namespace llarp
/// hidden service address
typedef llarp::AlignedBuffer< 16 > VanityNonce;
}
}
} // namespace service
} // namespace llarp
#endif

@ -5,16 +5,6 @@
namespace llarp
{
/** initialize llarp_buffer_t from stack allocated buffer */
template < typename T >
void
StackBuffer(llarp_buffer_t& buff, T& stack)
{
buff.base = stack;
buff.cur = buff.base;
buff.sz = sizeof(stack);
}
template < typename T >
llarp_buffer_t
StackBuffer(T& stack)

@ -62,7 +62,7 @@ llarp_load_config(struct llarp_config *conf, const char *fname)
void
llarp_config_iter(struct llarp_config *conf, struct llarp_config_iterator *iter)
{
iter->conf = conf;
iter->conf = conf;
std::map< std::string, llarp::Config::section_t & > sections = {
{"network", conf->impl.network},
{"connect", conf->impl.connect},

@ -304,7 +304,7 @@ struct llarp_main *
llarp_main_init(const char *fname, bool multiProcess)
{
if(!fname)
fname = "daemon.ini";
fname = "daemon.ini";
char *var = getenv("LLARP_DEBUG");
if(var && *var == '1')
{

@ -226,8 +226,7 @@ namespace iwp
llarp::ShortHash T;
byte_t tmp[64];
llarp_buffer_t buf;
llarp::StackBuffer< decltype(tmp) >(buf, tmp);
llarp_buffer_t buf = llarp::StackBuffer< decltype(tmp) >(tmp);
// T = HS(token + n)
memcpy(tmp, token, 32);

@ -171,6 +171,14 @@ namespace llarp
return path && path->SendRoutingMessage(&reply, router);
}
void
Context::LookupIntroSet(const service::Address &addr, const Key_t &whoasked,
uint64_t txid, const Key_t &askpeer, bool iterative,
std::set< Key_t > excludes)
{
// TODO: implement
}
void
Context::LookupRouter(const Key_t &target, const Key_t &whoasked,
uint64_t txid, const Key_t &askpeer,

@ -38,7 +38,10 @@ namespace llarp
switch(*strbuf.base)
{
case 'F':
dec->msg = new FindIntroMessage(dec->From);
if(dec->relayed)
dec->msg = new RelayedFindIntroMessage();
else
dec->msg = new FindIntroMessage(dec->From);
case 'R':
if(dec->relayed)
dec->msg = new RelayedFindRouterMessage(dec->From);

@ -78,4 +78,4 @@ namespace llarp
return result;
}
}
}
} // namespace llarp

@ -1,11 +1,23 @@
#include <llarp/dht/context.hpp>
#include <llarp/dht/messages/findintro.hpp>
#include <llarp/dht/messages/gotintro.hpp>
#include <llarp/routing/message.hpp>
namespace llarp
{
namespace dht
{
struct IntroSetLookupInformer
{
llarp_router* router;
service::Address target;
void
SendReply(const llarp::routing::IMessage* msg)
{
}
};
FindIntroMessage::~FindIntroMessage()
{
}
@ -13,15 +25,60 @@ namespace llarp
bool
FindIntroMessage::DecodeKey(llarp_buffer_t k, llarp_buffer_t* val)
{
// TODO: implement me
return false;
uint64_t i = 0;
bool read = false;
if(BEncodeMaybeReadDictInt("I", i, read, k, val))
{
if(read)
{
iterative = i != 0;
}
}
else
return false;
if(!BEncodeMaybeReadDictInt("R", R, read, k, val))
return false;
if(!BEncodeMaybeReadDictEntry("S", S, read, k, val))
return false;
if(!BEncodeMaybeReadDictInt("T", T, read, k, val))
return false;
if(!BEncodeMaybeReadVersion("V", version, LLARP_PROTO_VERSION, read, k,
val))
return false;
return read;
}
bool
FindIntroMessage::BEncode(llarp_buffer_t* buf) const
{
/// TODO: implement me
return false;
if(!bencode_start_dict(buf))
return false;
// message id
if(!BEncodeWriteDictMsgType(buf, "A", "F"))
return false;
// iterative
if(!BEncodeWriteDictInt(buf, "I", iterative ? 1 : 0))
return false;
// r5n counter
if(!BEncodeWriteDictInt(buf, "R", R))
return false;
// service address
if(!BEncodeWriteDictEntry("S", S, buf))
return false;
// txid
if(!BEncodeWriteDictInt(buf, "T", T))
return false;
// protocol version
if(!BEncodeWriteDictInt(buf, "V", LLARP_PROTO_VERSION))
return false;
return bencode_end(buf);
}
bool
@ -29,8 +86,42 @@ namespace llarp
llarp_dht_context* ctx,
std::vector< llarp::dht::IMessage* >& replies) const
{
auto& dht = ctx->impl;
auto introset = dht.GetIntroSetByServiceAddress(S);
auto& dht = ctx->impl;
const auto introset = dht.GetIntroSetByServiceAddress(S);
if(introset)
{
replies.push_back(new GotIntroMessage(T, introset));
return true;
}
else
{
Key_t peer;
std::set< Key_t > exclude = {dht.OurKey(), From};
if(dht.nodes->FindCloseExcluding(S, peer, exclude))
{
dht.LookupIntroSet(S, From, 0, peer);
return true;
}
else
{
llarp::LogError("cannot find closer peers for introset lookup for ",
S);
}
}
return false;
}
RelayedFindIntroMessage::~RelayedFindIntroMessage()
{
}
bool
RelayedFindIntroMessage::HandleMessage(
llarp_dht_context* ctx,
std::vector< llarp::dht::IMessage* >& replies) const
{
auto& dht = ctx->impl;
const auto introset = dht.GetIntroSetByServiceAddress(S);
if(introset)
{
replies.push_back(new GotIntroMessage(T, introset));
@ -38,7 +129,18 @@ namespace llarp
}
else
{
// do lookup
Key_t peer;
std::set< Key_t > exclude = {dht.OurKey()};
if(dht.nodes->FindCloseExcluding(S, peer, exclude))
{
dht.LookupIntroSet(S, From, 0, peer);
return true;
}
else
{
llarp::LogError("cannot find closer peers for introset lookup for ",
S);
}
}
return false;
}

@ -211,7 +211,7 @@ handle_recvfrom(const char *buffer, ssize_t nbytes, const struct sockaddr *from,
}
sockaddr *hostRes = nullptr;
if(0)
if(1)
{
hostRes = resolveHost(m_qName.c_str());
llarp::Addr anIp(*hostRes);

@ -92,8 +92,8 @@ namespace llarp
{
if(size() <= size_t(EncryptedFrame::OverheadSize))
{
llarp::LogWarn("encrypted frame too small, ", size(), " <= ",
size_t(EncryptedFrame::OverheadSize));
llarp::LogWarn("encrypted frame too small, ", size(),
" <= ", size_t(EncryptedFrame::OverheadSize));
return false;
}
// format of frame is

@ -179,7 +179,7 @@ namespace ini
lp = l.parent;
size_t n = l.depth - depth;
for(size_t i = 0; i < n; ++i)
lp = lp->parent;
lp = lp->parent;
parent = lp;
lp = &lp->sections[sname];
}

@ -196,8 +196,8 @@ frame_state::inbound_frame_complete(uint64_t id)
if(memcmp(digest, rxmsg->msginfo.hash(), 32))
{
llarp::LogWarn("message hash missmatch ",
llarp::AlignedBuffer< 32 >(digest), " != ",
llarp::AlignedBuffer< 32 >(rxmsg->msginfo.hash()));
llarp::AlignedBuffer< 32 >(digest),
" != ", llarp::AlignedBuffer< 32 >(rxmsg->msginfo.hash()));
return false;
}

@ -30,7 +30,6 @@ llarp_link_session::llarp_link_session(llarp_link *l, const byte_t *seckey,
: udp(&l->udp)
, crypto(&l->router->crypto)
, iwp(l->iwp)
, logic(l->router->logic)
, serv(l)
, outboundFrames("iwp_outbound")
, decryptedFrames("iwp_inbound")
@ -45,6 +44,7 @@ llarp_link_session::llarp_link_session(llarp_link *l, const byte_t *seckey,
llarp_rc_clear(&remote_router);
crypto->randbytes(token, 32);
llarp::LogInfo("session created");
frame.alive();
}
llarp_link_session::~llarp_link_session()
@ -74,6 +74,8 @@ llarp_link_session::sendto(llarp_buffer_t msg)
bool
llarp_link_session::timedout(llarp_time_t now, llarp_time_t timeout)
{
if(now <= frame.lastEvent)
return false;
auto diff = now - frame.lastEvent;
return diff >= timeout;
}
@ -118,7 +120,7 @@ llarp_link_session::close()
// as session invalidated
frame.txflags |= eSessionInvalidated;
// TODO: add timer for session invalidation
llarp_logic_queue_job(logic, {this, &send_keepalive});
llarp_logic_queue_job(serv->logic, {this, &send_keepalive});
}
void
@ -128,7 +130,7 @@ llarp_link_session::session_established()
llarp::LogInfo("Session to ", remote, " established");
EnterState(eEstablished);
serv->MapAddr(addr, remote_router.pubkey);
llarp_logic_cancel_call(logic, establish_job_id);
llarp_logic_cancel_call(serv->logic, establish_job_id);
}
llarp_rc *
@ -141,9 +143,9 @@ void
llarp_link_session::add_outbound_message(uint64_t id, transit_message *msg)
{
llarp::LogDebug("add outbound message ", id, " of size ",
msg->msginfo.totalsize(), " numfrags=",
(int)msg->msginfo.numfrags(), " lastfrag=",
(int)msg->msginfo.lastfrag());
msg->msginfo.totalsize(),
" numfrags=", (int)msg->msginfo.numfrags(),
" lastfrag=", (int)msg->msginfo.lastfrag());
frame.queue_tx(id, msg);
pump();
@ -296,6 +298,8 @@ llarp_link_session::done()
void
llarp_link_session::PumpCryptoOutbound()
{
if(working)
return;
working = true;
llarp_threadpool_queue_job(serv->worker, {this, &handle_crypto_outbound});
}
@ -568,8 +572,8 @@ llarp_link_session::introduce(uint8_t *pub)
llarp::RouterID(remote));
iwp_call_async_gen_intro(iwp, &intro);
// start introduce timer
establish_job_id =
llarp_logic_call_later(logic, {5000, this, &handle_establish_timeout});
establish_job_id = llarp_logic_call_later(
serv->logic, {5000, this, &handle_establish_timeout});
}
void

@ -30,8 +30,8 @@ namespace llarp
return false;
if(version != LLARP_PROTO_VERSION)
{
llarp::LogWarn("llarp protocol version missmatch ", version, " != ",
LLARP_PROTO_VERSION);
llarp::LogWarn("llarp protocol version missmatch ", version,
" != ", LLARP_PROTO_VERSION);
return false;
}
llarp::LogDebug("LIM version ", version);

@ -138,8 +138,9 @@ struct llarp_nodedb
buf.sz = buf.cur - buf.base;
auto filepath = getRCFilePath(pk);
llarp::LogDebug("saving RC.pubkey ", filepath);
std::ofstream ofs(filepath, std::ofstream::out & std::ofstream::binary
& std::ofstream::trunc);
std::ofstream ofs(
filepath,
std::ofstream::out & std::ofstream::binary & std::ofstream::trunc);
ofs.write((char *)buf.base, buf.sz);
ofs.close();
if(!ofs)

@ -413,8 +413,8 @@ namespace llarp
Path::HandlePathTransferMessage(
const llarp::routing::PathTransferMessage* msg, llarp_router* r)
{
llarp::LogWarn("unwarrented path transfer message on tx=", TXID(), " rx=",
RXID());
llarp::LogWarn("unwarrented path transfer message on tx=", TXID(),
" rx=", RXID());
return false;
}

@ -49,8 +49,8 @@ namespace llarp
{
if(frames.size() != MAXHOPS)
{
llarp::LogError("LRCM invalid number of records, ", frames.size(), "!=",
MAXHOPS);
llarp::LogError("LRCM invalid number of records, ", frames.size(),
"!=", MAXHOPS);
return false;
}
if(!router->paths.AllowingTransit())

@ -117,6 +117,7 @@ llarp_router::SendToOrQueue(const llarp::RouterID &remote,
// we don't have the RC locally so do a dht lookup
llarp_router_lookup_job *lookup = new llarp_router_lookup_job;
lookup->user = this;
llarp_rc_clear(&lookup->result);
memcpy(lookup->target, remote, PUBKEYSIZE);
lookup->hook = &HandleDHTLookupForSendTo;
llarp_dht_lookup_router(this->dht, lookup);

@ -56,8 +56,8 @@ namespace llarp
{
return path->HandleDownstream(T.Buffer(), Y, r);
}
llarp::LogWarn("No such local path for path transfer src=", from, " dst=",
P);
llarp::LogWarn("No such local path for path transfer src=", from,
" dst=", P);
return false;
}
} // namespace routing

@ -61,5 +61,5 @@ namespace llarp
delete service;
return false;
}
}
}
} // namespace service
} // namespace llarp
Loading…
Cancel
Save