Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

closes #1138: LRU bootstrap cache #1139

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

povilasb
Copy link
Contributor

Evict peers from bootstrap cache only when the cache is full and we want to cache a new peer.

src/main/bootstrap/cache.rs Outdated Show resolved Hide resolved
@povilasb povilasb force-pushed the lru-bootstrap-cache branch from 78927c0 to 75d7b6e Compare March 1, 2019 10:58
src/main/active_connection.rs Outdated Show resolved Hide resolved
* Make it LRU rather than TLRU cache;
* that means inactive peers for prolonged time won't be just removed from the cache;
* even if peers are dead, keep them in the cache, if there is free room available;
* when cache is full and we want to add new entry, simply remove the least recently
  used.
If we fail to connect to some peer, it does not mean we won't be able to
connect to it in 5 minutes or so.  Hence, don't just remove cached
peers. Peers will be evicted from the bootstrap cache, if there's no
more room for new directly accessible peers.

Keep remove() function for future use which will definitely happen.
When a packet is received from remote peer that was previously put in
bootstrap cache, make sure we let the cache know that the peer is
active.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants