// AutoUpdate will automatically update the listener. If a non-nil
// certUpdates chan is provided, it will receive timestamps for
// reissued certificates. If errChan is non-nil, any errors that occur
// in the updater will be passed along.
551006
func (tr *Transport) AutoUpdate(certUpdates chan<- time.Time, errChan chan<- error) {
	defer func() {
		if r := recover(); r != nil {
			log.Criticalf("AutoUpdate panicked: %v", r)
		}
	}()

	for {
		// Wait until it's time to update the certificate.
		target := time.Now().Add(tr.Lifespan())
		if PollInterval == 0 {
			<-time.After(tr.Lifespan())
		} else {
			pollWait(target)
		}

		// Keep trying to update the certificate until it's
		// ready.
		for {
			log.Debugf("attempting to refresh keypair")
			err := tr.RefreshKeys()
			if err == nil {
				break
			}

			delay := tr.Backoff.Duration()
			log.Debugf("failed to update certificate, will try again in %s", delay)
			if errChan != nil {
				errChan <- err
			}

			<-time.After(delay)
		}

		log.Debugf("certificate updated")
		if certUpdates != nil {
			certUpdates <- time.Now()
		}

		tr.Backoff.Reset()
	}
}
899920
func (s *DomainName) SetCertificateUploadDate(v time.Time) *DomainName {
	s.CertificateUploadDate = &v
	return s
}
1300949
func keyUpdates(key string) {
	currVal, _, _ := netAgent.Get("network", key)
	newVal := make([]byte, len(currVal))
	newVal = []byte("value1")
	netAgent.Put("haha", key, newVal, currVal)
	time.Sleep(time.Second * 2)
	updArray := []byte("value2")
	netAgent.Put("haha", key, updArray, newVal)
	time.Sleep(time.Second * 2)
}
414974
func (s *AutoScaleService) NewUpdateAutoScaleVmGroupParams(id string) *UpdateAutoScaleVmGroupParams {
	p := &UpdateAutoScaleVmGroupParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
68941
func (c *CodebaseController) Update(ctx *app.UpdateCodebaseContext) error {
	codebaseID, err := uuid.FromString(ctx.CodebaseID)
	if err != nil {
		return err
	}
	// see if the user is allowed to update this codebase
	cb, err := c.verifyCodebaseOwner(ctx, codebaseID)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	// set only allowed fields
	reqAttributes := ctx.Payload.Data.Attributes
	if reqAttributes.CveScan != nil {
		cb.CVEScan = *reqAttributes.CveScan
	}
	if reqAttributes.StackID != nil {
		cb.StackID = reqAttributes.StackID
	}
	if reqAttributes.Type != nil {
		cb.Type = *reqAttributes.Type
	}

	var updatedCb *codebase.Codebase
	// now save the object back into the database
	err = application.Transactional(c.db, func(appl application.Application) error {
		updatedCb, err = appl.Codebases().Save(ctx, cb)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	res := &app.CodebaseSingle{
		Data: ConvertCodebase(ctx.Request, *updatedCb),
	}
	ctx.ResponseData.Header().Set("Location", rest.AbsoluteURL(ctx.Request, app.CodebaseHref(res.Data.ID)))

	return ctx.OK(res)
}
308592
func (c *Configurator) Update(config Config) error {
	cert, err := loadKeyPair(config.CertFile, config.KeyFile)
	if err != nil {
		return err
	}
	cas, err := loadCAs(config.CAFile, config.CAPath)
	if err != nil {
		return err
	}

	if err = c.check(config, cas, cert); err != nil {
		return err
	}
	c.Lock()
	c.base = &config
	c.cert = cert
	c.cas = cas
	c.version++
	c.Unlock()
	c.log("Update")
	return nil
}
628999
func (api *WebAccelAPI) UpdateCertificate(id string, request *sacloud.WebAccelCertRequest) (*sacloud.WebAccelCertResponse, error) {
	uri := fmt.Sprintf("%s/site/%s/certificate", api.getResourceURL(), id)

	if request.CertificateChain != "" {
		request.CertificateChain = strings.TrimRight(request.CertificateChain, "\n")
	}
	if request.Key != "" {
		request.Key = strings.TrimRight(request.Key, "\n")
	}

	data, err := api.client.newRequest("PUT", uri, map[string]interface{}{
		"Certificate": request,
	})
	if err != nil {
		return nil, err
	}

	var res sacloud.WebAccelCertResponse
	if err := json.Unmarshal(data, &res); err != nil {
		return nil, err
	}
	return &res, nil
}
616551
func (s *Server) SendUpdate(update interface{}) error {

	select {
	case s.updates <- update:
		return nil
	case <-s.quit:
		return ErrServerShuttingDown
	}
}
591377
func (c *Ctx) VerifyUpdate(sh SessionHandle, part []byte) error {
	e := C.VerifyUpdate(c.ctx, C.CK_SESSION_HANDLE(sh), cMessage(part), C.CK_ULONG(len(part)))
	return toError(e)
}
410613
func (c *Client) ClientUpdate(properties ...CmdArg) error {
	_, err := c.ExecCmd(NewCmd("clientupdate").WithArgs(properties...))
	return err
}
793365
func keyUpdates(key string) {
	valArray, _, _ := ecc.Get("network", key)
	currVal := make([]byte, len(valArray))
	copy(currVal, valArray)
	valArray = []byte("value1")
	ecc.Put("network", key, valArray, currVal)
	time.Sleep(time.Second * 2)
	updArray := []byte("value2")
	ecc.Put("network", key, updArray, valArray)
	time.Sleep(time.Second * 2)
}
472142
func (client *Client) UpdateRecord(ctx context.Context, name string, rec UpdateDNSRecord) (*DNSRecord, error) {
	body, err := json.Marshal(UpdateDNSRecordResponse{
		Record: rec,
	})
	if err != nil {
		return nil, err
	}

	id := strconv.FormatInt(rec.ID, 10)
	resp, err := client.dnsRequest(ctx, "/v1/domains/"+name+"/records/"+id, nil, string(body), "PUT")
	if err != nil {
		return nil, err
	}

	var r DNSRecordResponse
	if err = json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &(r.Record), nil
}
302755
func (apiServerStatusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
	return validation.ValidateAPIServiceStatusUpdate(obj.(*apiregistration.APIService), old.(*apiregistration.APIService))
}
235583
func (s *server) applyChannelUpdate(update *lnwire.ChannelUpdate) error {
	pubKey := s.identityPriv.PubKey()
	errChan := s.authGossiper.ProcessLocalAnnouncement(update, pubKey)
	select {
	case err := <-errChan:
		return err
	case <-s.quit:
		return ErrServerShuttingDown
	}
}
1186381
func (p *AppProxy) processCertificateUpdates(puInfo *policy.PUInfo, client *clientData, caPool *x509.CertPool) (bool, error) {

	// If there are certificates provided, we will need to update them for the
	// services. If the certificates are nil, we ignore them.
	certPEM, keyPEM, caPEM := puInfo.Policy.ServiceCertificates()
	if certPEM == "" || keyPEM == "" {
		return false, nil
	}

	// Process any updates on the cert pool
	if caPEM != "" {
		if !caPool.AppendCertsFromPEM([]byte(caPEM)) {
			zap.L().Warn("Failed to add Services CA")
		}
	}

	// Create the TLS certificate
	tlsCert, err := tls.X509KeyPair([]byte(certPEM), []byte(keyPEM))
	if err != nil {
		return false, fmt.Errorf("Invalid certificates: %s", err)
	}

	for _, server := range client.netserver {
		server.UpdateSecrets(&tlsCert, caPool, p.secrets, certPEM, keyPEM)
	}
	return true, nil
}
785171
func (podDisruptionBudgetStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
	validationErrorList := validation.ValidatePodDisruptionBudget(obj.(*policy.PodDisruptionBudget))
	updateErrorList := validation.ValidatePodDisruptionBudgetUpdate(obj.(*policy.PodDisruptionBudget), old.(*policy.PodDisruptionBudget))
	return append(validationErrorList, updateErrorList...)
}
1183666
func ValidateRuntimeClassUpdate(new, old *node.RuntimeClass) field.ErrorList {
	allErrs := apivalidation.ValidateObjectMetaUpdate(&new.ObjectMeta, &old.ObjectMeta, field.NewPath("metadata"))

	allErrs = append(allErrs, apivalidation.ValidateImmutableField(new.Handler, old.Handler, field.NewPath("handler"))...)

	return allErrs
}