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 bug in delta xds server #458

Merged
merged 4 commits into from
Jul 20, 2021
Merged
Changes from 2 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
26 changes: 13 additions & 13 deletions pkg/server/delta/v3/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,25 +162,25 @@ func (s *server) processDelta(str stream.DeltaStream, reqCh <-chan *discovery.De
// Since there was no previous state, we know we're handling the first request of this type
// so we set the initial resource versions if we have any, and also signal if this stream is in wildcard mode.
watch.state = stream.NewStreamState(len(req.GetResourceNamesSubscribe()) == 0, req.GetInitialResourceVersions())
watch.responses = make(chan cache.DeltaResponse, 1)

} else {
// We must signal goroutine termination to prevent a race between the cancel closing the watch
alecholmez marked this conversation as resolved.
Show resolved Hide resolved
// and the producer closing the watch.
watch.Cancel()
}

s.subscribe(req.GetResourceNamesSubscribe(), watch.state.ResourceVersions)
s.unsubscribe(req.GetResourceNamesUnsubscribe(), watch.state.ResourceVersions)
s.subscribe(req.GetResourceNamesSubscribe(), watch.state.ResourceVersions)
s.unsubscribe(req.GetResourceNamesUnsubscribe(), watch.state.ResourceVersions)

watch.cancel = s.cache.CreateDeltaWatch(req, watch.state, watch.responses)
watches.deltaWatches[typeURL] = watch
watch.responses = make(chan cache.DeltaResponse, 1)
alecholmez marked this conversation as resolved.
Show resolved Hide resolved
watch.cancel = s.cache.CreateDeltaWatch(req, watch.state, watch.responses)
watches.deltaWatches[typeURL] = watch

go func() {
resp, more := <-watch.responses
if more {
watches.deltaMuxedResponses <- resp
}
}()
}
go func() {
resp, more := <-watch.responses
if more {
watches.deltaMuxedResponses <- resp
}
}()
}
}
}
Expand Down