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

Fix discarding explicit routes while removing duplicate ones #4414

Merged
merged 1 commit into from Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions server/route.go
Expand Up @@ -2083,8 +2083,9 @@ func handleDuplicateRoute(remote, c *client, setNoReconnect bool) {
// removeRoute() now does the right thing of doing that only when
// the closed connection was an added route connection.
c.mu.Lock()
didSolict := c.route.didSolicit
didSolicit := c.route.didSolicit
url := c.route.url
rtype := c.route.routeType
if setNoReconnect {
c.flags.set(noReconnect)
}
Expand All @@ -2095,10 +2096,15 @@ func handleDuplicateRoute(remote, c *client, setNoReconnect bool) {
}

remote.mu.Lock()
if didSolict && !remote.route.didSolicit {
if didSolicit && !remote.route.didSolicit {
remote.route.didSolicit = true
remote.route.url = url
}
// The extra route might be an configured explicit route
// so keep the state that the remote was configured.
if rtype == Explicit {
remote.route.routeType = rtype
}
// This is to mitigate the issue where both sides add the route
// on the opposite connection, and therefore end-up with both
// connections being dropped.
Expand Down