Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/web/app/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,18 @@ func (t *transport) DialContext(ctx context.Context, _, _ string) (conn net.Conn
break
}

// eliminate any servers from the head of the list that were unreachable
t.mu.Lock()
if i < len(servers) {
t.c.servers = t.c.servers[i:]
} else {
t.c.servers = nil
// Only attempt to tidy up the list of servers if they weren't altered
// while the dialing happened. Since the lock is only held initially when
// making the servers copy and released during the dials, another dial attempt
// may have already happened and modified the list of servers.
if len(servers) == len(t.c.servers) {
// eliminate any servers from the head of the list that were unreachable
if i < len(t.c.servers) {
t.c.servers = t.c.servers[i:]
} else {
t.c.servers = nil
}
}
t.mu.Unlock()

Expand Down