handleControlChannelUpdate handles updates to service config fields which influence the control channel to the RLS server. Caller must hold lb.stateMu.
(newCfg *lbConfig)
| 358 | // |
| 359 | // Caller must hold lb.stateMu. |
| 360 | func (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. |
no test coverage detected