rebuild exit paths if they die

pull/593/head
Jeff Becker 5 years ago
parent 779b1f4df5
commit 5fa85acaf7
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -26,9 +26,10 @@ namespace llarp
{ {
} }
void BaseSession::HandlePathDied(path::Path_ptr) void
BaseSession::HandlePathDied(path::Path_ptr p)
{ {
BuildOne(); p->Rebuild();
} }
util::StatusObject util::StatusObject

@ -515,6 +515,16 @@ namespace llarp
return obj; return obj;
} }
void
Path::Rebuild()
{
std::vector< RouterContact > newHops;
for(const auto& hop : hops)
newHops.emplace_back(hop.rc);
LogInfo(Name(), " rebuilding on ", HopsString());
m_PathSet->Build(newHops);
}
void void
Path::Tick(llarp_time_t now, AbstractRouter* r) Path::Tick(llarp_time_t now, AbstractRouter* r)
{ {

@ -435,6 +435,11 @@ namespace llarp
bool bool
Expired(llarp_time_t now) const override; Expired(llarp_time_t now) const override;
/// build a new path on the same set of hops as us
/// regenerates keys
void
Rebuild();
void void
Tick(llarp_time_t now, AbstractRouter* r); Tick(llarp_time_t now, AbstractRouter* r);

@ -76,6 +76,11 @@ namespace llarp
virtual void virtual void
BuildOne(PathRole roles = ePathRoleAny) = 0; BuildOne(PathRole roles = ePathRoleAny) = 0;
/// manual build on these hops
virtual void
Build(const std::vector< RouterContact >& hops,
PathRole roles = ePathRoleAny) = 0;
/// tick owned paths /// tick owned paths
virtual void virtual void
Tick(llarp_time_t now) = 0; Tick(llarp_time_t now) = 0;

Loading…
Cancel
Save