fix up more stuff

pull/15/head
Jeff Becker 6 years ago
parent c9ac70a4e4
commit 2eca0005c1
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -126,7 +126,9 @@ namespace llarp
void
PutNode(const Val_t& val)
{
nodes.insert(std::make_pair(val.ID, val));
auto itr = nodes.find(val.ID);
if(itr == nodes.end() || itr->second < val)
nodes.insert(std::make_pair(val.ID, val));
}
void

@ -25,6 +25,12 @@ namespace llarp
rc = other;
ID = other.pubkey.data();
}
bool
operator<(const RCNode& other) const
{
return rc.OtherIsNewer(other.rc);
}
};
struct ISNode
@ -42,7 +48,12 @@ namespace llarp
{
introset = other;
introset.A.CalculateAddress(ID);
llarp::LogInfo("make ISNode with topic ", introset.topic.ToString());
}
bool
operator<(const ISNode& other) const
{
return introset.OtherIsNewer(other.introset);
}
};
} // namespace dht

@ -84,6 +84,12 @@ namespace llarp
bool
Sign(llarp_crypto *crypto, const llarp::SecretKey &secret);
bool
OtherIsNewer(const RouterContact &other) const
{
return last_updated < other.last_updated;
}
bool
Read(const char *fname);

@ -75,6 +75,12 @@ namespace llarp
return A < other.A;
}
bool
OtherIsNewer(const IntroSet& other) const
{
return GetNewestIntroExpiration() < other.GetNewestIntroExpiration();
}
friend std::ostream&
operator<<(std::ostream& out, const IntroSet& i)
{
@ -101,12 +107,6 @@ namespace llarp
return out << " V=" << i.version << " Z=" << i.Z;
}
bool
OtherIsNewerThan(const IntroSet& other) const
{
return GetNewestIntroExpiration() < other.GetNewestIntroExpiration();
}
llarp_time_t
GetNewestIntroExpiration() const
{

@ -729,7 +729,7 @@ namespace llarp
Endpoint::OutboundContext::OnIntroSetUpdate(const Address& addr,
const IntroSet* i)
{
if(i && addr == i->A.Addr() && currentIntroSet.OtherIsNewerThan(*i))
if(i && addr == i->A.Addr() && currentIntroSet.OtherIsNewer(*i))
{
currentIntroSet = *i;
}

Loading…
Cancel
Save