From 5861f4aafae18cdbf956fa7db411f9e794553b2a Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Fri, 12 Apr 2019 08:05:43 -0400 Subject: [PATCH 1/2] * less vigorous profiling * don't spam connections to bootstrap --- llarp/profiling.cpp | 2 +- llarp/router/router.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/llarp/profiling.cpp b/llarp/profiling.cpp index f76964d5b..3734fcaab 100644 --- a/llarp/profiling.cpp +++ b/llarp/profiling.cpp @@ -73,7 +73,6 @@ namespace llarp if(connectTimeoutCount > chances) return connectTimeoutCount < connectGoodCount && (pathSuccessCount * chances) > pathFailCount; - chances /= 2; return (pathSuccessCount * chances) > pathFailCount; } @@ -212,6 +211,7 @@ namespace llarp llarp::LogWarn("failed to load router profiles from ", fname); return false; } + m_LastSave = llarp::time_now_ms(); return true; } diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 46872f166..4e43b6c68 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -838,7 +838,7 @@ namespace llarp { if(StrEq(key, "type") && StrEq(val, "syslog")) { - // TODO(despair): write event log syslog class + // TODO(despair): write event log syslog class #if defined(_WIN32) LogError("syslog not supported on win32"); #else @@ -1146,6 +1146,8 @@ namespace llarp { for(const auto &rc : bootstrapRCList) { + if(HasPendingConnectJob(rc.pubkey)) + continue; TryConnectAsync(rc, 4); dht()->impl->ExploreNetworkVia(dht::Key_t{rc.pubkey}); } From 3aa0cc9d0b78fd4fb273b5279e78aa87e4828ae6 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Fri, 12 Apr 2019 08:20:03 -0400 Subject: [PATCH 2/2] address issue #510 --- llarp/dns/message.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/llarp/dns/message.cpp b/llarp/dns/message.cpp index eeede938b..76a1b1a0b 100644 --- a/llarp/dns/message.cpp +++ b/llarp/dns/message.cpp @@ -152,8 +152,7 @@ namespace llarp return true; } - void - Message::AddServFail(RR_TTL_t ttl) + void Message::AddServFail(RR_TTL_t) { if(questions.size()) { @@ -162,15 +161,6 @@ namespace llarp hdr_fields |= flags_QR | flags_AA | flags_RA; // don't allow recursion on this request hdr_fields &= ~flags_RD; - answers.emplace_back(); - const auto& question = questions[0]; - auto& nx = answers.back(); - nx.rr_name = question.qname; - nx.rr_type = question.qtype; - nx.rr_class = question.qclass; - nx.ttl = ttl; - nx.rData.resize(1); - nx.rData.data()[0] = 0; } } @@ -294,8 +284,7 @@ namespace llarp nx.rr_type = question.qtype; nx.rr_class = question.qclass; nx.ttl = ttl; - nx.rData.resize(1); - nx.rData.data()[0] = 0; + nx.rData.resize(0); } } }