* don't ban bootstrap nodes with profiling

* less vigorous profiling timeouts
* async remove rc from disk
pull/523/head
Jeff 5 years ago
parent 7a83f71713
commit 5834607997

@ -281,7 +281,7 @@ namespace llarp
using namespace std::placeholders; using namespace std::placeholders;
if(self->record.work if(self->record.work
&& self->record.work->IsValid( && 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 ", llarp::LogDebug("LRCM extended lifetime by ",
self->record.work->extendedLifetime, " seconds for ", self->record.work->extendedLifetime, " seconds for ",

@ -18,13 +18,16 @@ static const std::string RC_FILE_EXT = ".signed";
bool bool
llarp_nodedb::Remove(const llarp::RouterID &pk) llarp_nodedb::Remove(const llarp::RouterID &pk)
{ {
llarp::util::Lock lock(&access); bool removed = false;
auto itr = entries.find(pk); RemoveIf([&](const llarp::RouterContact &rc) -> bool {
if(itr == entries.end()) if(rc.pubkey == pk)
{
removed = true;
return true;
}
return false; return false;
entries.erase(itr); });
fs::remove(fs::path(getRCFilePath(pk))); return removed;
return true;
} }
void void

@ -71,15 +71,16 @@ struct TryConnectJob
void void
AttemptTimedout() AttemptTimedout()
{ {
router->routerProfiling().MarkTimeout(rc.pubkey);
if(ShouldRetry()) if(ShouldRetry())
{ {
Attempt(); Attempt();
return; return;
} }
router->routerProfiling().MarkTimeout(rc.pubkey);
if(router->routerProfiling().IsBad(rc.pubkey)) if(router->routerProfiling().IsBad(rc.pubkey))
{ {
router->nodedb()->Remove(rc.pubkey); if(!router->IsBootstrapNode(rc.pubkey))
router->nodedb()->Remove(rc.pubkey);
} }
// delete this // delete this
router->pendingEstablishJobs.erase(rc.pubkey); router->pendingEstablishJobs.erase(rc.pubkey);
@ -1102,7 +1103,7 @@ namespace llarp
if(!routerProfiling().IsBad(rc.pubkey)) if(!routerProfiling().IsBad(rc.pubkey))
return false; return false;
routerProfiling().ClearProfile(rc.pubkey); routerProfiling().ClearProfile(rc.pubkey);
return true; return !IsBootstrapNode(rc.pubkey);
}); });
} }
paths.TickPaths(now); paths.TickPaths(now);
@ -1690,12 +1691,8 @@ namespace llarp
&& !(self->HasSessionTo(other.pubkey) && !(self->HasSessionTo(other.pubkey)
|| self->HasPendingConnectJob(other.pubkey))) || self->HasPendingConnectJob(other.pubkey)))
{ {
for(const auto &rc : self->bootstrapRCList) if(!self->IsBootstrapNode(other.pubkey))
{ self->TryConnectAsync(other, 5);
if(rc.pubkey == other.pubkey)
return want > 0;
}
self->TryConnectAsync(other, 5);
--want; --want;
} }
return want > 0; return want > 0;

@ -77,7 +77,8 @@ bencode_write_uint64(llarp_buffer_t* buff, uint64_t i)
{ {
// NetBSDs also do this shit in long mode, wouldn't be surprised // NetBSDs also do this shit in long mode, wouldn't be surprised
// if all the BSDs do by default // if all the BSDs do by default
#if !defined(__LP64__) || (__APPLE__ && __MACH__) || (__NetBSD__) || (__OpenBSD__) #if !defined(__LP64__) || (__APPLE__ && __MACH__) || (__NetBSD__) \
|| (__OpenBSD__)
if(!buff->writef("i%llu", i)) if(!buff->writef("i%llu", i))
#else #else
if(!buff->writef("i%lu", i)) if(!buff->writef("i%lu", i))

@ -16,8 +16,8 @@ struct llarp_threadpool
std::queue< std::function< void(void) > > jobs GUARDED_BY(m_access); std::queue< std::function< void(void) > > jobs GUARDED_BY(m_access);
llarp_threadpool(int workers, const char *name) llarp_threadpool(int workers, const char *name)
: impl(std::make_unique< llarp::thread::ThreadPool >(workers, : impl(
workers * 128)) std::make_unique< llarp::thread::ThreadPool >(workers, workers * 128))
{ {
(void)name; (void)name;
} }

Loading…
Cancel
Save