don't use profiling if service node

pull/69/head
Jeff Becker 6 years ago
parent 5cbfccfff4
commit 94ad765b8e
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -66,8 +66,11 @@ struct TryConnectJob
Attempt(); Attempt();
return; return;
} }
if(router->routerProfiling.IsBad(rc.pubkey)) if(!router->IsServiceNode())
llarp_nodedb_del_rc(router->nodedb, rc.pubkey); {
if(router->routerProfiling.IsBad(rc.pubkey))
llarp_nodedb_del_rc(router->nodedb, rc.pubkey);
}
// delete this // delete this
router->pendingEstablishJobs.erase(rc.pubkey); router->pendingEstablishJobs.erase(rc.pubkey);
} }
@ -326,6 +329,12 @@ llarp_router::SaveRC()
return rc().Write(our_rc_file.string().c_str()); return rc().Write(our_rc_file.string().c_str());
} }
bool
llarp_router::IsServiceNode() const
{
return inboundLinks.size() > 0;
}
void void
llarp_router::Close() llarp_router::Close()
{ {
@ -424,7 +433,7 @@ llarp_router::TryEstablishTo(const llarp::RouterID &remote)
// try connecting async // try connecting async
llarp_router_try_connect(this, rc, 5); llarp_router_try_connect(this, rc, 5);
} }
else if(!routerProfiling.IsBad(remote)) else if(IsServiceNode() || !routerProfiling.IsBad(remote))
{ {
if(dht->impl.HasRouterLookup(remote)) if(dht->impl.HasRouterLookup(remote))
return; return;
@ -457,7 +466,8 @@ llarp_router::HandleDHTLookupForTryEstablishTo(
{ {
if(results.size() == 0) if(results.size() == 0)
{ {
routerProfiling.MarkTimeout(remote); if(!IsServiceNode())
routerProfiling.MarkTimeout(remote);
} }
for(const auto &result : results) for(const auto &result : results)
{ {

@ -186,6 +186,10 @@ struct llarp_router
bool bool
InitServiceNode(); InitServiceNode();
/// return true if we are running in service node mode
bool
IsServiceNode() const;
void void
Close(); Close();

Loading…
Cancel
Save