Pull hostmap and pending hostmap apart, remove unused functions #843
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main
HostMap
has concerns that the pending host map does not and has led to bugs in recent changes.This change puts
HandshakeManager
in charge of its own dedicated maps that share some similarity with the mainHostMap
but lacks all the extra cruft. This also removes some unused code from the mainHostMap
as a result of the split.My main concern is:
HandshakeManager.AddVpnIp
will go for a write lock immediately,Interface.getOrHandshake
won't attempt check the pending hostmap before making a call to this function. This avoids a read lock to write lock trading race that lead to the overcomplication ofInterface.getOrHandshake
long ago. The concern is when restarting nebula on a busy host with many tunnels, there will be a period of strong write lock contention until the tunnels form or the services using the overlay slow down transmitting until replies come in.If we believe this is an issue I can go back to behavior similar to the old way that still sets us up to simplify
Interface.getOrHandshake
in the future with a read lock check and a write lock check before proceeding to add.