MCPcopy
hub / github.com/grpc/grpc-go / handleControlChannelUpdate

Method handleControlChannelUpdate

balancer/rls/balancer.go:360–382  ·  view source on GitHub ↗

handleControlChannelUpdate handles updates to service config fields which influence the control channel to the RLS server. Caller must hold lb.stateMu.

(newCfg *lbConfig)

Source from the content-addressed store, hash-verified

358//
359// Caller must hold lb.stateMu.
360func (b *rlsBalancer) handleControlChannelUpdate(newCfg *lbConfig) {
361 if newCfg.lookupService == b.lbCfg.lookupService && newCfg.lookupServiceTimeout == b.lbCfg.lookupServiceTimeout {
362 return
363 }
364
365 // Create a new control channel and close the existing one.
366 b.logger.Infof("Creating control channel to RLS server at: %v", newCfg.lookupService)
367 backToReadyFn := func() {
368 b.updateCh.Put(controlChannelReady{})
369 }
370 ctrlCh, err := newControlChannel(newCfg.lookupService, newCfg.controlChannelServiceConfig, newCfg.lookupServiceTimeout, b.bopts, backToReadyFn)
371 if err != nil {
372 // This is very uncommon and usually represents a non-transient error.
373 // There is not much we can do here other than wait for another update
374 // which might fix things.
375 b.logger.Errorf("Failed to create control channel to %q: %v", newCfg.lookupService, err)
376 return
377 }
378 if b.ctrlCh != nil {
379 b.ctrlCh.close()
380 }
381 b.ctrlCh = ctrlCh
382}
383
384// handleChildPolicyConfigUpdate handles updates to service config fields which
385// influence child policy configuration.

Callers 1

UpdateClientConnStateMethod · 0.95

Calls 5

newControlChannelFunction · 0.85
InfofMethod · 0.65
PutMethod · 0.65
ErrorfMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected