Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache peers list #756

Open
wants to merge 4 commits into
base: mesh-cleanup
Choose a base branch
from
Open

Cache peers list #756

wants to merge 4 commits into from

Conversation

mariusSincovici
Copy link
Contributor

No description provided.

Split is done in order to allow creating separate functionality
expansions when data is retrieved from API or uploaded to API.

Signed-off-by: Savolro <me@savolro.com>
lastMap := r.lastMap
peerPub := r.peerPub
r.mu.RUnlock()
if !forceUpdate && !bytes.Equal(lastMap, resp.Raw) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this condition is not correct 🤔
shouldn't be if forceUpdate || !bytes.Equal(lastMap, resp.Raw) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated coment with the explaination

When meshnet map is requested from the `mesh.Retriever`, instead of
calling API directly, it is called via `CachingRetriever`. Also,
`NotifyingRegistry` was introduced as well to make sure that any changes
to meshnet map made by this device would notify the subscribers about
it. This also means, that application now reacts to these changes in a
same way as it does to NC messages, therefore it is no longer needed to
call networker directly from meshnet map modifying gRPC functions.

Signed-off-by: Savolro <me@savolro.com>
When accepting meshnet invitations, it is guaranteed that new peer is
added to the meshnet. Therefore, it is valid to refresh meshnet at this
point.

Signed-off-by: Savolro <me@savolro.com>
Signed-off-by: Savolro <me@savolro.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants