Exemple #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));
        }
Exemple #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));
        }