Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for withCancelCause (0.3 sec)

  1. src/context/x_test.go

    			err:   Canceled,
    			cause: Canceled,
    		},
    		{
    			name: "WithCancelCause",
    			ctx: func() Context {
    				ctx, cancel := WithCancelCause(Background())
    				cancel(parentCause)
    				return ctx
    			},
    			err:   Canceled,
    			cause: parentCause,
    		},
    		{
    			name: "WithCancelCause nil",
    			ctx: func() Context {
    				ctx, cancel := WithCancelCause(Background())
    				cancel(nil)
    				return ctx
    			},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 26.3K bytes
    - Viewed (0)
  2. src/context/context.go

    type CancelCauseFunc func(cause error)
    
    // WithCancelCause behaves like [WithCancel] but returns a [CancelCauseFunc] instead of a [CancelFunc].
    // Calling cancel with a non-nil error (the "cause") records that error in ctx;
    // it can then be retrieved using Cause(ctx).
    // Calling cancel with nil sets the cause to Canceled.
    //
    // Example use:
    //
    //	ctx, cancel := context.WithCancelCause(parent)
    //	cancel(myError)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 23.7K bytes
    - Viewed (0)
  3. src/net/http/transport_internal_test.go

    		if err != nil {
    			t.Error(err)
    			return
    		}
    		connc <- c
    	}()
    
    	tr := new(Transport)
    	req, _ := NewRequest("GET", "http://"+ln.Addr().String(), nil)
    	req = req.WithT(t)
    	ctx, cancel := context.WithCancelCause(context.Background())
    	treq := &transportRequest{Request: req, ctx: ctx, cancel: cancel}
    	cm := connectMethod{targetScheme: "http", targetAddr: ln.Addr().String()}
    	pc, err := tr.getConn(treq, cm)
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 15:57:17 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/server/genericapiserver_graceful_termination_test.go

    		// the server signals the next steps
    		<-beforeShutdownDelayDurationStep.done()
    	}, nil)
    
    	// start the API server
    	_, ctx := ktesting.NewTestContext(t)
    	stopCtx, stop := context.WithCancelCause(ctx)
    	defer stop(errors.New("test has completed"))
    	runCompletedCh := make(chan struct{})
    	go func() {
    		defer close(runCompletedCh)
    		if err := s.PrepareRun().RunWithContext(stopCtx); err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 38.3K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testserver.go

    	// TODO: this is a candidate for using what is now test/utils/ktesting,
    	// should that become a staging repo.
    	ctx, cancel := context.WithCancelCause(context.Background())
    	var errCh chan error
    	tearDown := func() {
    		// Cancel is stopping apiextensions apiserver and its
    		// delegates, which itself is cleaning up after itself,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 9K bytes
    - Viewed (1)
  6. staging/src/k8s.io/apiserver/pkg/server/options/serving_test.go

    	}
    
    	for title := range tests {
    		test := tests[title]
    		t.Run(title, func(t *testing.T) {
    			t.Parallel()
    			_, ctx := ktesting.NewTestContext(t)
    			ctx, cancel := context.WithCancelCause(ctx)
    			defer cancel(errors.New("test has completed"))
    
    			// create server cert
    			certDir := "testdata/" + specToName(test.Cert)
    			serverCertBundleFile := filepath.Join(certDir, "cert")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 09 15:52:39 UTC 2024
    - 13.8K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/server/config_test.go

    				}
    			}
    		}
    	}
    }
    
    func TestNewWithDelegate(t *testing.T) {
    	_, ctx := ktesting.NewTestContext(t)
    	ctx, cancel := context.WithCancelCause(ctx)
    	defer cancel(errors.New("test is done"))
    	delegateConfig := NewConfig(codecs)
    	delegateConfig.ExternalAddress = "192.168.10.4:443"
    	delegateConfig.PublicAddress = netutils.ParseIPSloppy("192.168.10.4")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 13.1K bytes
    - Viewed (0)
  8. pkg/kubelet/cm/dra/plugin/noderesources.go

    	defer c.mutex.Unlock()
    
    	if active := c.activePlugins[driverName]; active != nil {
    		active.cancel(errors.New("plugin has re-registered"))
    	}
    	active := &activePlugin{}
    	cancelCtx, cancel := context.WithCancelCause(c.ctx)
    	active.cancel = cancel
    	c.activePlugins[driverName] = active
    	c.queue.Add(driverName)
    
    	c.wg.Add(1)
    	go func() {
    		defer c.wg.Done()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 27 20:12:53 UTC 2024
    - 16.6K bytes
    - Viewed (0)
  9. internal/grid/muxclient.go

    }
    
    // Response is a response from the server.
    type Response struct {
    	Msg []byte
    	Err error
    }
    
    func newMuxClient(ctx context.Context, muxID uint64, parent *Connection) *muxClient {
    	ctx, cancelFn := context.WithCancelCause(ctx)
    	return &muxClient{
    		MuxID:              muxID,
    		ctx:                ctx,
    		cancelFn:           cancelFn,
    		parent:             parent,
    		LastPong:           time.Now().UnixNano(),
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri Jun 07 15:51:52 UTC 2024
    - 15.9K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/server/genericapiserver.go

    	// Canceling the parent context does not immediately cancel the HTTP server.
    	// We only inherit context values here and deal with cancellation ourselves.
    	stopHTTPServerCtx, stopHTTPServer := context.WithCancelCause(context.WithoutCancel(ctx))
    	go func() {
    		defer stopHTTPServer(errors.New("time to stop HTTP server"))
    
    		timeToStopHttpServerCh := notAcceptingNewRequestCh.Signaled()
    		if s.ShutdownSendRetryAfter {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:59:21 UTC 2024
    - 42.9K bytes
    - Viewed (0)
Back to top