// CancelBounce cancels the dock bounce
340487
func (d *Dock) CancelBounce(id int) (err error) {
	if err = d.isActionable(); err != nil {
		return
	}
	_, err = synchronousEvent(d.c, d, d.w, Event{Name: eventNameDockCmdCancelBounce, TargetID: d.id, ID: PtrInt(id)}, eventNameDockEventBouncingCancelled)
	return
}
1102437
func (s *PrioritySlot) Stop() {
	s.mu.Lock()
	defer s.mu.Unlock()
	if s.cancel != nil {
		s.cancel()
		s.cancel = nil
		s.priority = 0
	}
}
537034
func (c *OperatorRekeyCommand) cancel(client *api.Client) int {
	// Handle the different API requests
	var fn func() error
	switch strings.ToLower(strings.TrimSpace(c.flagTarget)) {
	case "barrier":
		fn = client.Sys().RekeyCancel
		if c.flagVerify {
			fn = client.Sys().RekeyVerificationCancel
		}
	case "recovery", "hsm":
		fn = client.Sys().RekeyRecoveryKeyCancel
		if c.flagVerify {
			fn = client.Sys().RekeyRecoveryKeyVerificationCancel
		}

	default:
		c.UI.Error(fmt.Sprintf("Unknown target: %s", c.flagTarget))
		return 1
	}

	// Make the request
	if err := fn(); err != nil {
		c.UI.Error(fmt.Sprintf("Error canceling rekey: %s", err))
		return 2
	}

	c.UI.Output("Success! Canceled rekeying (if it was started)")
	return 0
}
884898
func (s *storageImpl) CancelUpload(c context.Context, r *api.CancelUploadRequest) (resp *api.UploadOperation, err error) {
	defer func() { err = grpcutil.GRPCifyAndLogErr(c, err) }()

	handleOpStatus := func(op *upload.Operation) (*api.UploadOperation, error) {
		if op.Status == api.UploadStatus_ERRORED || op.Status == api.UploadStatus_CANCELED {
			return op.ToProto(r.UploadOperationId), nil
		}
		return nil, errors.Reason("the operation is in state %s and can't be canceled", op.Status).Tag(grpcutil.FailedPreconditionTag).Err()
	}

	// Grab the corresponding operation and inspect its status.
	op, err := fetchOp(c, r.UploadOperationId)
	switch {
	case err != nil:
		return nil, err
	case op.Status != api.UploadStatus_UPLOADING:
		return handleOpStatus(op)
	}

	// Move the operation to canceled state and launch the TQ task to cleanup.
	mutated, err := op.Advance(c, func(c context.Context, op *upload.Operation) error {
		op.Status = api.UploadStatus_CANCELED
		return s.tq.AddTask(c, &tq.Task{
			Payload: &tasks.CleanupUpload{
				UploadOperationId: op.ID,
				UploadUrl:         op.UploadURL,
				PathToCleanup:     op.TempGSPath,
			},
			Title: fmt.Sprintf("%d", op.ID),
		})
	})
	if err != nil {
		return nil, errors.Annotate(err, "failed to start the cleanup task").
			Tag(grpcutil.InternalTag).Err()
	}
	return handleOpStatus(mutated)
}
110224
func (api *PublicWhisperAPI) CancelLightClient(ctx context.Context) bool {
	api.w.SetLightClientMode(false)
	return !api.w.LightClientMode()
}
502608
func (u *Unit) CancelAction(action Action) (Action, error) {
	return action.Finish(ActionResults{Status: ActionCancelled})
}
654379
func (mc *mysqlConn) cancel(err error) {
	mc.canceled.Set(err)
	mc.cleanup()
}
1236145
func (b *Builder) Cancel(ctx context.Context, id string) error {
	b.mu.Lock()
	if j, ok := b.jobs[id]; ok && j.cancel != nil {
		j.cancel()
	}
	b.mu.Unlock()
	return nil
}
10695
func (api *API) CancelActiveOffers() (err error) {
	offers, err := api.ActiveOffers()
	if err != nil {
		return
	}

	for _, o := range offers {
		err = api.CancelOffer(o.ID)

		if err != nil {
			return
		}
	}

	return
}
1135713
func (h *handler) cancelAllRequests(err error, inflightReq *requestOp) {
	didClose := make(map[*requestOp]bool)
	if inflightReq != nil {
		didClose[inflightReq] = true
	}

	for id, op := range h.respWait {
		// Remove the op so that later calls will not close op.resp again.
		delete(h.respWait, id)

		if !didClose[op] {
			op.err = err
			close(op.resp)
			didClose[op] = true
		}
	}
	for id, sub := range h.clientSubs {
		delete(h.clientSubs, id)
		sub.quitWithError(err, false)
	}
}
1363922
func (r *TasksService) Cancel(swarmingrpcstaskscancelrequest *SwarmingRpcsTasksCancelRequest) *TasksCancelCall {
	c := &TasksCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.swarmingrpcstaskscancelrequest = swarmingrpcstaskscancelrequest
	return c
}
508889
func (nc *Controller) cancelPodEviction(node *v1.Node) bool {
	zone := utilnode.GetZoneKey(node)
	nc.evictorLock.Lock()
	defer nc.evictorLock.Unlock()
	wasDeleting := nc.zonePodEvictor[zone].Remove(node.Name)
	if wasDeleting {
		klog.V(2).Infof("Cancelling pod Eviction on Node: %v", node.Name)
		return true
	}
	return false
}
660661
func (md *MDServerMemory) CancelRegistration(_ context.Context, id tlf.ID) {
	md.updateManager.cancel(id, md)
}
880255
func (n *TxNotifier) CancelSpend(spendRequest SpendRequest, spendID uint64) {
	select {
	case <-n.quit:
		return
	default:
	}

	n.Lock()
	defer n.Unlock()

	spendSet, ok := n.spendNotifications[spendRequest]
	if !ok {
		return
	}
	ntfn, ok := spendSet.ntfns[spendID]
	if !ok {
		return
	}

	Log.Infof("Canceling spend notification: spend_id=%d, %v", spendID,
		spendRequest)

	// We'll close all the notification channels to let the client know
	// their cancel request has been fulfilled.
	close(ntfn.Event.Spend)
	close(ntfn.Event.Reorg)
	close(ntfn.Event.Done)
	delete(spendSet.ntfns, spendID)
}
1341080
func Abort(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "abort", Listener: listener}
}
696992
func (w *Wrapped) Cancel() error {
	w.once.Do(w.init)
	w.cancelLock.Lock()

	// If we have a result set, return that
	if w.resultSet {
		w.cancelLock.Unlock()
		return w.resultErr
	}

	// If we have a cancel channel, close it to signal and set it to
	// nil so we never do that again.
	if w.cancelCh != nil {
		close(w.cancelCh)
		w.cancelCh = nil
	}

	// Wait for the result to be set
	defer w.cancelLock.Unlock()
	w.cancelCond.Wait()
	return w.resultErr
}
975074
func (h *AccountHandler) CancelReset(ctx context.Context, sessionID int) error {
	mctx := libkb.NewMetaContext(ctx, h.G())
	return libkb.CancelResetPipeline(mctx)
}