Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for GetSubroute (0.23 sec)

  1. internal/grid/README.md

            fmt.Println("Got request with initial payload", p, "from", GetCaller(ctx context.Context))
            fmt.Println("Subroute:", GetSubroute(ctx))
            for {
                select {
                case <-ctx.Done():
                    return nil
                case req, ok := <-in:
                    if !ok {
                        break
    Plain Text
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 9.4K bytes
    - Viewed (0)
  2. internal/grid/handlers.go

    	return val
    }
    
    // GetSubroute returns caller information from contexts provided to handlers.
    func GetSubroute(ctx context.Context) string {
    	val, _ := ctx.Value(ctxSubrouteKey{}).(string)
    	return val
    }
    
    func setCaller(ctx context.Context, cl *RemoteClient) context.Context {
    	return context.WithValue(ctx, ctxCallerKey{}, cl)
    }
    
    func setSubroute(ctx context.Context, s string) context.Context {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 26.9K bytes
    - Viewed (0)
  3. internal/grid/grid_test.go

    	// 1: Echo
    	register := func(manager *Manager) {
    		errFatal(handler.Register(manager, func(ctx context.Context, pp *testRequest, in <-chan *testRequest, out chan<- *testResponse) *RemoteErr {
    			sub := GetSubroute(ctx)
    			if sub != "subroute/1" {
    				t.Fatal("expected subroute/1, got", sub)
    			}
    			n := 0
    			for i := range in {
    				if n > payloads {
    					panic("too many requests")
    				}
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Feb 08 18:15:27 GMT 2024
    - 30.1K bytes
    - Viewed (0)
  4. internal/grid/muxserver.go

    }
    
    func newMuxStream(ctx context.Context, msg message, c *Connection, handler StreamHandler) *muxServer {
    	var cancel context.CancelFunc
    	ctx = setCaller(ctx, c.remote)
    	if len(handler.Subroute) > 0 {
    		ctx = setSubroute(ctx, handler.Subroute)
    	}
    	if msg.DeadlineMS > 0 {
    		ctx, cancel = context.WithTimeout(ctx, time.Duration(msg.DeadlineMS)*time.Millisecond+c.addDeadline)
    	} else {
    		ctx, cancel = context.WithCancel(ctx)
    	}
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 9.1K bytes
    - Viewed (0)
Back to top