MCPcopy Index your code
hub / github.com/google/seesaw / run

Method run

engine/vserver.go:473–516  ·  view source on GitHub ↗

run invokes a vserver. This is a long-lived Go routine that lasts for the duration of the vserver, reacting to configuration changes and healthcheck notifications.

()

Source from the content-addressed store, hash-verified

471// duration of the vserver, reacting to configuration changes and healthcheck
472// notifications.
473func (v *vserver) run() {
474 statsTicker := time.NewTicker(v.engine.config.StatsInterval)
475 for {
476 select {
477 case <-v.quit:
478 // Shutdown active vservers, services and destinations.
479 // There is no race between this and new healthcheck
480 // notifications, since they are also handled via the
481 // same vserver go routine.
482 v.downAll()
483 statsTicker.Stop()
484 v.engine.hcManager.vcc <- vserverChecks{vserverName: v.config.Name}
485 v.unconfigureVIPs()
486
487 // Return any firewall marks that were allocated to
488 // this vserver.
489 for _, fwm := range v.fwm {
490 v.engine.fwmAlloc.put(fwm)
491 }
492
493 v.stopped <- true
494 return
495
496 case o := <-v.overrideChan:
497 v.handleOverride(o)
498 v.engine.hcManager.vcc <- v.healthchecks()
499
500 case config := <-v.update:
501 v.handleConfigUpdate(config)
502 v.engine.hcManager.vcc <- v.healthchecks()
503
504 case n := <-v.notify:
505 v.handleCheckNotification(n)
506
507 case <-statsTicker.C:
508 v.updateStats()
509 select {
510 case v.engine.vserverChan <- v.snapshot():
511 default:
512 log.Warningf("%v: failed to send snapshot", v)
513 }
514 }
515 }
516}
517
518// stop tells a running vserver that it should quit.
519func (v *vserver) stop() {

Callers

nothing calls this directly

Calls 10

downAllMethod · 0.95
unconfigureVIPsMethod · 0.95
handleOverrideMethod · 0.95
healthchecksMethod · 0.95
handleConfigUpdateMethod · 0.95
updateStatsMethod · 0.95
snapshotMethod · 0.95
StopMethod · 0.80
putMethod · 0.80

Tested by

no test coverage detected