Skip to content

Conversation

@andrew-d
Copy link
Member

Previously, when updating endpoints we would immediately stop advertising any endpoint that wasn't discovered during determineEndpoints. This could result in, for example, a case where we performed an incremental netcheck, didn't get any of our three STUN packets back, and then dropped our STUN endpoint from the set of advertised endpoints... which would result in clients falling back to a DERP connection until the next call to determineEndpoints.

Instead, let's cache endpoints that we've discovered and continue reporting them to clients until a timeout expires. In the above case where we temporarily don't have a discovered STUN endpoint, we would continue reporting the old value, then re-discover the STUN endpoint again and continue reporting it as normal, so clients never see a withdrawal.

Updates tailscale/coral#108

Change-Id: I42de72e7418ab328a6c732bdefc74549708cf8b9

Copy link
Member

@danderson danderson left a comment

Choose a reason for hiding this comment

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

The data structures in endpointTracker feel like they could be more efficient, but I couldn't work out the exact shape of them during code review, and that's easy to improve later on. LGTM.

andrew-d added a commit that referenced this pull request Apr 14, 2023
For use in #7877

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I712d09c6d1a180c6633abe3acf8feb59b27e2866
andrew-d added a commit that referenced this pull request Apr 14, 2023
This is an exact copy of the files misc/set/set{,_test}.go from corp as
of the time this commit was created, plus the license headers.

For use in #7877

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I712d09c6d1a180c6633abe3acf8feb59b27e2866
@andrew-d andrew-d force-pushed the andrew/endpoints-advertise-timeout branch from a360f19 to 057605e Compare April 14, 2023 22:28
andrew-d added a commit that referenced this pull request Apr 14, 2023
This is an exact copy of the files misc/set/set{,_test}.go from
tailscale/corp@a5415da, plus the
license headers.

For use in #7877

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I712d09c6d1a180c6633abe3acf8feb59b27e2866
andrew-d added a commit that referenced this pull request Apr 14, 2023
This is an exact copy of the files misc/set/set{,_test}.go from
tailscale/corp@a5415da, plus the
license headers.

For use in #7877

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I712d09c6d1a180c6633abe3acf8feb59b27e2866
@andrew-d andrew-d force-pushed the andrew/endpoints-advertise-timeout branch 2 times, most recently from bb6c04e to 531e20a Compare April 14, 2023 23:35
…ing them

Previously, when updating endpoints we would immediately stop
advertising any endpoint that wasn't discovered during
determineEndpoints. This could result in, for example, a case where we
performed an incremental netcheck, didn't get any of our three STUN
packets back, and then dropped our STUN endpoint from the set of
advertised endpoints... which would result in clients falling back to a
DERP connection until the next call to determineEndpoints.

Instead, let's cache endpoints that we've discovered and continue
reporting them to clients until a timeout expires. In the above case
where we temporarily don't have a discovered STUN endpoint, we would
continue reporting the old value, then re-discover the STUN endpoint
again and continue reporting it as normal, so clients never see a
withdrawal.

Updates tailscale/coral#108

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I42de72e7418ab328a6c732bdefc74549708cf8b9
@andrew-d andrew-d force-pushed the andrew/endpoints-advertise-timeout branch from 531e20a to 4760e84 Compare April 17, 2023 15:14
@andrew-d andrew-d merged commit 80b138f into main Apr 17, 2023
@andrew-d andrew-d deleted the andrew/endpoints-advertise-timeout branch April 17, 2023 15:26
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.

3 participants