make format

pull/81/head
Jeff Becker 6 years ago
parent 0ac6deff00
commit 5d0a9d7dc7
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -112,7 +112,8 @@ namespace llarp
if((prevPeer ^ targetKey) < (peer ^ targetKey))
{
// next peer is not closer
llarp::LogInfo("next peer ", peer, " is not closer to ", target, " than ", prevPeer);
llarp::LogInfo("next peer ", peer, " is not closer to ", target,
" than ", prevPeer);
return false;
}
else
@ -314,7 +315,7 @@ namespace llarp
std::make_pair(k, time_now_ms() + requestTimeoutMS));
}
if(count == 0)
t->Start(askpeer);
t->Start(askpeer);
}
/// mark tx as not fond

@ -142,7 +142,7 @@ namespace llarp
#ifdef TESTNET
llarp::LogInfo("Got message from ", msg->sender.Addr());
#else
(void) msg;
(void)msg;
#endif
return true;
}

@ -3,7 +3,7 @@
#include <cstdint>
using llarp_proto_version_t = std::uint8_t;
using llarp_time_t = std::uint64_t;
using llarp_seconds_t = std::uint64_t;
using llarp_time_t = std::uint64_t;
using llarp_seconds_t = std::uint64_t;
#endif

File diff suppressed because it is too large Load Diff

@ -242,8 +242,8 @@ extern "C"
// llarp::LogDebug("Advancing to pos ", std::to_string(*pos));
moveable += (*pos); // advance to position
//hexDump(moveable, 12);
//hexDumpAt(buffer, *pos, 12);
// hexDump(moveable, 12);
// hexDumpAt(buffer, *pos, 12);
if(*moveable == '\xc0')
{
@ -267,10 +267,10 @@ extern "C"
/*
uint32_t readAt32 = *pos;
answer->name = getDNSstring(buffer, &readAt32);
llarp::LogInfo("Parsed string ", answer->name, " read ", std::to_string(readAt32));
moveable += readAt32; (*pos) += readAt32;
llarp::LogInfo("Parsed string ", answer->name, " read ",
std::to_string(readAt32)); moveable += readAt32; (*pos) += readAt32;
*/
//moveable++; (*pos)++;
// moveable++; (*pos)++;
}
/*
hexDump(moveable, 10);
@ -330,12 +330,12 @@ extern "C"
// FIXME: move this out of here, this shouldn't be responsible for decode
switch(answer->type)
{
case 2: // NS
case 2: // NS
// don't really need to do anything here
moveable += answer->rdLen;
(*pos) += answer->rdLen; // advance the length
break;
case 5:
break;
case 5:
moveable += answer->rdLen;
(*pos) += answer->rdLen; // advance the length
break;
@ -371,10 +371,10 @@ extern "C"
{
std::string revname = getDNSstring(buffer, pos);
llarp::LogInfo("revDNSname: ", revname);
//answer->rData = new uint8_t[answer->rdLen + 1];
// answer->rData = new uint8_t[answer->rdLen + 1];
answer->rData.resize(answer->rdLen);
memcpy(answer->rData.data(), revname.c_str(), answer->rdLen);
//answer->rData = (uint8_t *)strdup(revname.c_str()); // safer? nope
// answer->rData = (uint8_t *)strdup(revname.c_str()); // safer? nope
moveable += answer->rdLen;
//(*pos) += answer->rdLen; // advance the length
}

@ -229,9 +229,10 @@ ReverseHandlerIter(struct llarp::service::Context::endpoint_iter *endpointCfg)
+ tokensCheck[2] + "." + tokensCheck[3];
llarp::LogDebug(searchIp, " vs ", checkIp);
llarp::IPRange range = llarp::iprange_ipv4(
std::stoi(tokensCheck[0]), std::stoi(tokensCheck[1]), std::stoi(tokensCheck[2]),
std::stoi(tokensCheck[3]), tunEndpoint->tunif.netmask); // create range
llarp::IPRange range =
llarp::iprange_ipv4(std::stoi(tokensCheck[0]), std::stoi(tokensCheck[1]),
std::stoi(tokensCheck[2]), std::stoi(tokensCheck[3]),
tunEndpoint->tunif.netmask); // create range
// hack atm to work around limitations in ipaddr_ipv4_bits and llarp::IPRange
llarp::huint32_t searchIPv4_fixed = llarp::ipaddr_ipv4_bits(
std::stoi(tokensSearch[searchTokens - 6]),

@ -224,13 +224,14 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
for(uint32_t i = 0; i < hdr->qdCount; i++)
{
question = decode_question(castBufc, &pos);
//llarp::LogDebug("Read a question, now at ", std::to_string(pos));
// llarp::LogDebug("Read a question, now at ", std::to_string(pos));
// 1 dot: 1 byte for length + length
// 4 bytes for class/type
// castBuf += question->name.length() + 1 + 4;
// castBuf += 2; // skip answer label
}
llarp::LogDebug("Question ", std::to_string(question->type), " ", question->name);
llarp::LogDebug("Question ", std::to_string(question->type), " ",
question->name);
// FIXME: only handling one atm
std::vector< dns_msg_answer * > answers;
@ -296,15 +297,15 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
// pos = 0; // reset pos
answer = decode_answer(castBufc, &pos);
// answers.push_back(answer);
llarp::LogDebug("Read an authority for ",
request->question.name, " at ", std::to_string(pos));
llarp::LogDebug("Read an authority for ", request->question.name, " at ",
std::to_string(pos));
// castBuf += answer->name.length() + 4 + 4 + 4 + answer->rdLen;
if((ssize_t)pos > sz)
{
llarp::LogWarn("Would read past end of dns packet. for ",
request->question.name);
break;
}
if((ssize_t)pos > sz)
{
llarp::LogWarn("Would read past end of dns packet. for ",
request->question.name);
break;
}
}
/*
@ -393,14 +394,14 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
int ip = 0;
// if no answer, just bail now
if (!answer)
{
request->found = false;
request->resolved(request);
return;
}
// if no answer, just bail now
if(!answer)
{
request->found = false;
request->resolved(request);
return;
}
/* search for and print IPv4 addresses */
// if(dnsQuery->reqType == 0x01)
/*
@ -603,7 +604,7 @@ llarp_handle_dnsc_recvfrom(struct llarp_udp_io *const udp,
llarp::LogDebug("Header got client responses for id: ", hdr->id);
// if we sent this out, then there's an id
struct dns_tracker *tracker = (struct dns_tracker *)udp->user;
struct dns_tracker *tracker = (struct dns_tracker *)udp->user;
struct dnsc_answer_request *request = tracker->client_request[hdr->id].get();
// sometimes we'll get double responses
@ -694,7 +695,7 @@ void
llarp_host_resolved(dnsc_answer_request *const request)
{
dns_tracker *tracker = (dns_tracker *)request->context->tracker;
auto val = std::find_if(
auto val = std::find_if(
tracker->client_request.begin(), tracker->client_request.end(),
[request](
std::pair< const uint32_t, std::unique_ptr< dnsc_answer_request > >
@ -735,7 +736,7 @@ llarp_dnsc_init(struct dnsc_context *const dnsc,
llarp::LogInfo("DNSc adding relay ", dnsc_sockaddr);
dnsc->resolvers.push_back(dnsc_sockaddr);
dnsc->tracker = &dns_udp_tracker;
dnsc->logic = logic;
dnsc->logic = logic;
return true;
}

@ -152,12 +152,12 @@ _llarp_nt_getadaptersaddresses(struct llarp_nt_ifaddrs_t** ifap)
fprintf(stderr, "IP_ADAPTER_ADDRESSES buffer length %lu bytes.\n", dwSize);
#endif
pAdapterAddresses = (IP_ADAPTER_ADDRESSES*)_llarp_nt_heap_alloc(dwSize);
dwRet = GetAdaptersAddresses(
AF_UNSPEC,
GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_ANYCAST
| GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME
| GAA_FLAG_SKIP_MULTICAST,
nullptr, pAdapterAddresses, &dwSize);
dwRet = GetAdaptersAddresses(AF_UNSPEC,
GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_ANYCAST
| GAA_FLAG_SKIP_DNS_SERVER
| GAA_FLAG_SKIP_FRIENDLY_NAME
| GAA_FLAG_SKIP_MULTICAST,
nullptr, pAdapterAddresses, &dwSize);
if(ERROR_BUFFER_OVERFLOW == dwRet)
{
_llarp_nt_heap_free(pAdapterAddresses);
@ -447,10 +447,10 @@ _llarp_nt_getadaptersaddresses(struct llarp_nt_ifaddrs_t** ifap)
ift->_ifa.ifa_next = (struct llarp_nt_ifaddrs_t*)(ift + 1);
ift = (struct _llarp_nt_ifaddrs_t*)(ift->_ifa.ifa_next);
}
else
else
{
ift->_ifa.ifa_next = nullptr;
}
ift->_ifa.ifa_next = nullptr;
}
}
}
@ -464,7 +464,7 @@ static unsigned
_llarp_nt_getadaptersaddresses_nametoindex(const char* ifname)
{
ULONG ifIndex;
DWORD dwSize = 4096, dwRet;
DWORD dwSize = 4096, dwRet;
IP_ADAPTER_ADDRESSES *pAdapterAddresses = nullptr, *adapter;
char szAdapterName[256];
@ -487,7 +487,7 @@ _llarp_nt_getadaptersaddresses_nametoindex(const char* ifname)
for(unsigned i = 3; i; i--)
{
pAdapterAddresses = (IP_ADAPTER_ADDRESSES*)_llarp_nt_heap_alloc(dwSize);
dwRet = GetAdaptersAddresses(
dwRet = GetAdaptersAddresses(
AF_UNSPEC,
GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_DNS_SERVER
| GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_MULTICAST,
@ -524,7 +524,8 @@ _llarp_nt_getadaptersaddresses_nametoindex(const char* ifname)
{
if(0 == strcmp(szAdapterName, adapter->AdapterName))
{
//ifIndex = AF_INET6 == iffamily ? adapter->Ipv6IfIndex : adapter->IfIndex;
// ifIndex = AF_INET6 == iffamily ? adapter->Ipv6IfIndex :
// adapter->IfIndex;
_llarp_nt_heap_free(pAdapterAddresses);
return ifIndex;
}

@ -70,7 +70,7 @@ namespace llarp
public:
static constexpr size_t Alignment = 64;
using AtomicIndex = std::atomic<std::uint32_t>;
using AtomicIndex = std::atomic< std::uint32_t >;
private:
AtomicIndex m_pushIndex; // Index in the buffer that the next
@ -90,7 +90,7 @@ namespace llarp
const uint32_t m_maxCombinedIndex; // Maximum combined value of index and
// generation for this object.
std::atomic<std::uint32_t>* m_states; // Array of index states.
std::atomic< std::uint32_t >* m_states; // Array of index states.
AtomicIndex&
pushIndex();

@ -383,7 +383,7 @@ llarp_router::on_verify_server_rc(llarp_async_verify_rc *job)
delete ctx;
router->DiscardOutboundFor(pk);
router->pendingVerifyRC.erase(pk);
return;
}
// we're valid, which means it's already been committed to the nodedb
@ -615,7 +615,7 @@ llarp_router::FlushOutboundFor(llarp::RouterID remote,
llarp::ILinkLayer *chosen)
{
llarp::LogDebug("Flush outbound for ", remote);
auto itr = outboundMessageQueue.find(remote);
if(itr == outboundMessageQueue.end())
{
@ -699,7 +699,7 @@ llarp_router::async_verify_RC(const llarp::RouterContact &rc,
job->hook = &llarp_router::on_verify_server_rc;
else
job->hook = &llarp_router::on_verify_client_rc;
llarp_nodedb_async_verify(job);
}

@ -154,7 +154,8 @@ struct llarp_router
pendingEstablishJobs;
// pending RCs to be verified by pubkey
std::unordered_map<llarp::RouterID, llarp_async_verify_rc, llarp::RouterID::Hash>
std::unordered_map< llarp::RouterID, llarp_async_verify_rc,
llarp::RouterID::Hash >
pendingVerifyRC;
// sessions to persist -> timestamp to end persist at
@ -258,8 +259,7 @@ struct llarp_router
/// manually flush outbound message queue for just 1 router
void
FlushOutboundFor(llarp::RouterID remote,
llarp::ILinkLayer *chosen = nullptr);
FlushOutboundFor(llarp::RouterID remote, llarp::ILinkLayer *chosen = nullptr);
/// manually discard all pending messages to remote router
void

@ -1113,9 +1113,12 @@ namespace llarp
}
}
// no converstation
return EnsurePathToService(remote, [](Address, OutboundContext* c) {
if(c) c->UpdateIntroSet(true);
}, 5000, false);
return EnsurePathToService(remote,
[](Address, OutboundContext* c) {
if(c)
c->UpdateIntroSet(true);
},
5000, false);
}
bool

Loading…
Cancel
Save