mirror of https://github.com/oxen-io/lokinet
* don't ban bootstrap nodes with profiling
* less vigorous profiling timeouts * async remove rc from disk
This commit is contained in:
parent
7a83f71713
commit
5834607997
|
@ -281,7 +281,7 @@ namespace llarp
|
|||
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 ",
|
||||
|
|
|
@ -18,13 +18,16 @@ static const std::string RC_FILE_EXT = ".signed";
|
|||
bool
|
||||
llarp_nodedb::Remove(const llarp::RouterID &pk)
|
||||
{
|
||||
llarp::util::Lock lock(&access);
|
||||
auto itr = entries.find(pk);
|
||||
if(itr == entries.end())
|
||||
bool removed = false;
|
||||
RemoveIf([&](const llarp::RouterContact &rc) -> bool {
|
||||
if(rc.pubkey == pk)
|
||||
{
|
||||
removed = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
entries.erase(itr);
|
||||
fs::remove(fs::path(getRCFilePath(pk)));
|
||||
return true;
|
||||
});
|
||||
return removed;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -71,15 +71,16 @@ struct TryConnectJob
|
|||
void
|
||||
AttemptTimedout()
|
||||
{
|
||||
router->routerProfiling().MarkTimeout(rc.pubkey);
|
||||
if(ShouldRetry())
|
||||
{
|
||||
Attempt();
|
||||
return;
|
||||
}
|
||||
router->routerProfiling().MarkTimeout(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
|
||||
router->pendingEstablishJobs.erase(rc.pubkey);
|
||||
|
@ -1102,7 +1103,7 @@ namespace llarp
|
|||
if(!routerProfiling().IsBad(rc.pubkey))
|
||||
return false;
|
||||
routerProfiling().ClearProfile(rc.pubkey);
|
||||
return true;
|
||||
return !IsBootstrapNode(rc.pubkey);
|
||||
});
|
||||
}
|
||||
paths.TickPaths(now);
|
||||
|
@ -1690,12 +1691,8 @@ namespace llarp
|
|||
&& !(self->HasSessionTo(other.pubkey)
|
||||
|| self->HasPendingConnectJob(other.pubkey)))
|
||||
{
|
||||
for(const auto &rc : self->bootstrapRCList)
|
||||
{
|
||||
if(rc.pubkey == other.pubkey)
|
||||
return want > 0;
|
||||
}
|
||||
self->TryConnectAsync(other, 5);
|
||||
if(!self->IsBootstrapNode(other.pubkey))
|
||||
self->TryConnectAsync(other, 5);
|
||||
--want;
|
||||
}
|
||||
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
|
||||
// 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))
|
||||
#else
|
||||
if(!buff->writef("i%lu", i))
|
||||
|
|
|
@ -16,8 +16,8 @@ struct llarp_threadpool
|
|||
std::queue< std::function< void(void) > > jobs GUARDED_BY(m_access);
|
||||
|
||||
llarp_threadpool(int workers, const char *name)
|
||||
: impl(std::make_unique< llarp::thread::ThreadPool >(workers,
|
||||
workers * 128))
|
||||
: impl(
|
||||
std::make_unique< llarp::thread::ThreadPool >(workers, workers * 128))
|
||||
{
|
||||
(void)name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue