code: func (l *State) syncCheck(id types.CheckID) error {
  	c := l.checks[id]
  
  	req := structs.RegisterRequest{
  		Datacenter:      l.config.Datacenter,
  		ID:              l.config.NodeID,
  		Node:            l.config.NodeName,
  		Address:         l.config.AdvertiseAddr,
  		TaggedAddresses: l.config.TaggedAddresses,
  		NodeMeta:        l.metadata,
  		Check:           c.Check,
  		WriteRequest:    structs.WriteRequest{Token: l.checkToken(id)},
  	}
  
  	// Pull in the associated service if any
  	s := l.services[c.Check.ServiceID]
  	if s != nil && !s.Deleted {
  		req.Service = s.Service
  	}
  
  	var out struct{}
  	err := l.Delegate.RPC("Catalog.Register", &req, &out)
  	switch {
  	case err == nil:
  		l.checks[id].InSync = true
  		// Given how the register API works, this info is also updated
  		// every time we sync a check.
  		l.nodeInfoInSync = true
  		l.logger.Printf("[INFO] agent: Synced check %q", id)
  		return nil
  
  	case acl.IsErrPermissionDenied(err), acl.IsErrNotFound(err):
  		// todo(fs): mark the check to be in sync to prevent excessive retrying before next full sync
  		// todo(fs): some backoff strategy might be a better solution
  		l.checks[id].InSync = true
  		l.logger.Printf("[WARN] agent: Check %q registration blocked by ACLs", id)
  		metrics.IncrCounter([]string{"acl", "blocked", "check", "registration"}, 1)
  		return nil
  
  	default:
  		l.logger.Printf("[WARN] agent: Syncing check %q failed. %s", id, err)
  		return err
  	}
  }
docs: // syncCheck is used to sync a check to the server