code: func (d *destination) updateState() {
  	// The destination is healthy if the backend is enabled and *all* the checks
  	// for that destination are healthy.
  	healthy := d.backend.Enabled
  	if healthy {
  		for _, c := range d.checks {
  			if c.status.State != healthcheck.StateHealthy {
  				healthy = false
  				break
  			}
  		}
  	}
  
  	if d.healthy == healthy {
  		return
  	}
  	d.healthy = healthy
  
  	switch {
  	case d.service.active && d.healthy:
  		// The service is already active. Bringing up the dest will have no effect
  		// on the service or vserver state.
  		d.up()
  
  	case d.service.active != d.healthy || d.service.healthy != d.healthy:
  		// The service may need to be brought up or down.
  		d.service.updateState()
  	}
  }
docs: // updateState updates the state of a destination based on the state of checks
  // and propagates state changes to the service level if necessary.