remove uneeded code

pull/1148/head
jeff 4 years ago
parent f293d4d783
commit 49e69d7087

@ -204,23 +204,10 @@ namespace llarp
return router->nodedb()->Get(k.as_array(), rc);
}
void
FloodRCLater(const dht::Key_t from, const RouterContact rc) override;
PendingIntrosetLookups _pendingIntrosetLookups;
PendingRouterLookups _pendingRouterLookups;
PendingExploreLookups _pendingExploreLookups;
using RCGossipReplayFilter_t = util::DecayingHashSet< RouterContact >;
RCGossipReplayFilter_t m_GossipReplayFilter;
using RCGossipList_t = std::unordered_multimap< RouterContact, RouterID,
RouterContact::Hash >;
/// list of RCs that we want to publish with who gave us the publish
RCGossipList_t m_GossipList;
PendingIntrosetLookups&
pendingIntrosetLookups() override
{
@ -281,9 +268,7 @@ namespace llarp
Key_t ourKey;
};
static constexpr auto GossipFilterDecayInterval = std::chrono::minutes(30);
Context::Context() : m_GossipReplayFilter(GossipFilterDecayInterval)
Context::Context()
{
randombytes((byte_t*)&ids, sizeof(uint64_t));
}
@ -322,40 +307,6 @@ namespace llarp
// clean up transactions
CleanupTX();
const llarp_time_t now = Now();
// flush pending floods
if(router->IsServiceNode())
{
std::unordered_set< RouterContact, RouterContact::Hash > keys;
for(const auto& item : m_GossipList)
{
// filter hit don't publish it at all
if(not m_GossipReplayFilter.Insert(item.first))
continue;
// skip if duplicate RC
if(not keys.emplace(item.first).second)
continue;
const auto& rc = item.first;
// build set of routers to not send to for this RC
std::set< RouterID > exclude = {rc.pubkey};
const auto range = m_GossipList.equal_range(rc);
auto itr = range.first;
while(itr != range.second)
{
exclude.emplace(itr->second);
++itr;
}
Nodes()->ForEachNode([self = this, rc, &exclude](const auto& node) {
const RouterID K(node.rc.pubkey);
if(exclude.find(K) == exclude.end())
self->DHTSendTo(K, new GotRouterMessage(rc));
});
}
}
// clear gossip list
m_GossipList.clear();
// decay gossip filter
m_GossipReplayFilter.Decay();
if(_services)
{
@ -553,16 +504,6 @@ namespace llarp
new ServiceAddressLookup(asker, addr, this, relayOrder, handler));
}
void
Context::FloodRCLater(const dht::Key_t from, const RouterContact rc)
{
// check valid rc
if(not router->rcLookupHandler().CheckRC(rc))
return;
m_GossipList.emplace(rc, from.as_array());
// TODO: don't publish our rc in next interval (based of whitelist size)
}
void
Context::LookupIntroSetDirect(
const Key_t& addr, const Key_t& whoasked, uint64_t txid,

@ -157,10 +157,6 @@ namespace llarp
virtual void
StoreRC(const RouterContact rc) const = 0;
/// flood rc to all peers later in a batch
virtual void
FloodRCLater(const dht::Key_t from, const RouterContact rc) = 0;
};
std::unique_ptr< AbstractContext >

@ -365,8 +365,6 @@ namespace llarp
LogWarn("failed to renegotiate session");
});
}
/// flood our rc
_dht->impl->FloodRCLater(dht::Key_t(pubkey()), _rc);
return SaveRC();
}

Loading…
Cancel
Save