Esempio n. 1
0
func flushConn(ctx context.Context, c *rpc.Conn) {
	// discard result
	c.Bootstrap(ctx).Call(&capnp.Call{
		Ctx:    ctx,
		Method: capnp.Method{InterfaceID: 0xdeadbeef, MethodID: 42},
	}).Struct()
}
Esempio n. 2
0
func readBootstrap(t *testing.T, ctx context.Context, conn *rpc.Conn, p rpc.Transport) (client capnp.Client, questionID uint32) {
	clientCh := make(chan capnp.Client, 1)
	go func() {
		clientCh <- conn.Bootstrap(ctx)
	}()

	msg, err := p.RecvMessage(ctx)
	if err != nil {
		t.Fatal("Read Bootstrap failed:", err)
	}
	if msg.Which() != rpccapnp.Message_Which_bootstrap {
		t.Fatalf("Received %v message from bootstrap, want Message_Which_bootstrap", msg.Which())
	}
	boot, err := msg.Bootstrap()
	if err != nil {
		t.Fatal("Read Bootstrap failed:", err)
	}
	questionID = boot.QuestionId()
	// If this deadlocks, then Bootstrap isn't using a promised client.
	client = <-clientCh
	if client == nil {
		t.Fatal("Bootstrap client is nil")
	}
	return
}
Esempio n. 3
0
func flushConn(ctx context.Context, c *rpc.Conn) {
	// discard result
	c.Bootstrap(ctx).Call(&capnp.Call{
		Ctx:        ctx,
		Method:     capnp.Method{InterfaceID: 0xdeadbeef, MethodID: 42},
		ParamsFunc: func(capnp.Struct) error { return nil },
		ParamsSize: capnp.ObjectSize{},
	}).Struct()
}