Exemplo n.º 1
0
        // 有返回值RPC CALL
        public async Task <IMessage> CallAsync(Head request)
        {
            CallRWStream stream = new CallRWStream();

            Streams.Add(stream.StreamId, stream);

            return(await stream.StreamWrightAsync(request, this));
        }
Exemplo n.º 2
0
        // 有返回值RPC CALL,可以取消
        public async Task <IMessage> CallAsync(Head request, CancellationToken cancellationToken)
        {
            CallRWStream stream = new CallRWStream();

            Streams.Add(stream.StreamId, stream);

            cancellationToken.Register(() => this.Streams.Remove(stream.StreamId));
            Send(request);

            return(await stream.StreamWrightAsync(request, this));
        }