Skip to content

Commit 66bced6

Browse files
author
Alan Diego
committed
Fix panic in case the resourceType is not know by the caches
1 parent bd58d40 commit 66bced6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/server/sotw/v3/xds.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,13 @@ func (s *server) process(str stream.Stream, reqCh chan *discovery.DiscoveryReque
149149
sw.watches.recompute(s.ctx, reqCh)
150150
default:
151151
// Channel n -> these are the dynamic list of responders that correspond to the stream request typeURL
152-
if !ok {
152+
// nil is used to close the streams in the caches
153+
if value.IsNil() || !ok {
153154
// Receiver channel was closed. TODO(jpeach): probably cancel the watch or something?
154155
return status.Errorf(codes.Unavailable, "resource watch %d -> failed", index)
155156
}
156157

158+
// If a non cache.Response arrived here, there are serious issues
157159
res := value.Interface().(cache.Response)
158160
nonce, err := sw.send(res)
159161
if err != nil {

0 commit comments

Comments
 (0)