示例#1
0
 protected override async Task WhenAsync(CancellationToken cancellation)
 {
     _message = (RstStream)(await Control.TryReadAsync(
                                new FrameReader(
                                    PipeReader.Create(new MemoryStream(Message))), cancellation)
                            .ConfigureAwait(false)).Result;
 }
示例#2
0
文件: SpdyStream.cs 项目: lulzzz/Port
        private void Send(
            RstStream rstStream)
        {
            CloseRemote();
            CloseLocal();

            Send((Frame)rstStream);
        }
示例#3
0
            protected override async Task WhenAsync(
                CancellationToken cancellationToken)
            {
                await Server.SendAsync(
                    RstStream.Cancel(_stream.Id),
                    cancellationToken)
                .ConfigureAwait(false);

                await _stream.Local.WaitForClosedAsync(cancellationToken)
                .ConfigureAwait(false);
            }
示例#4
0
文件: SpdyStream.cs 项目: lulzzz/Port
        private SpdyStream(
            SynStream synStream,
            ConcurrentPriorityQueue <Frame> sendingPriorityQueue)
        {
            _synStream            = synStream;
            _sendingPriorityQueue = sendingPriorityQueue;

            _streamInUse              = RstStream.StreamInUse(Id);
            _protocolError            = RstStream.ProtocolError(Id);
            _flowControlError         = RstStream.FlowControlError(Id);
            _streamAlreadyClosedError = RstStream.StreamAlreadyClosed(Id);
        }
示例#5
0
            protected override async Task WhenAsync(
                CancellationToken cancellationToken)
            {
                await Server.SendAsync(
                    new WindowUpdate(_stream.Id, UInt31.MaxValue),
                    cancellationToken)
                .ConfigureAwait(false);

                _rstStream = await _rstStreamSubscription
                             .ReceiveAsync(CancellationToken)
                             .ConfigureAwait(false);
            }
示例#6
0
            protected override async Task WhenAsync(
                CancellationToken cancellationToken)
            {
                await Server.SendAsync(
                    SynReply.Accept(_stream.Id),
                    cancellationToken)
                .ConfigureAwait(false);

                _rstStream = await _rstStreamSubscription
                             .ReceiveAsync(CancellationToken)
                             .ConfigureAwait(false);
            }
示例#7
0
            protected override async Task WhenAsync(
                CancellationToken cancellationToken)
            {
                var rstSubscription          = Server.On <RstStream>();
                var windowUpdateSubscription = Server.On <WindowUpdate>();
                await Server.SendAsync(Data.Last(_stream.Id, Encoding.UTF8.GetBytes("data")),
                                       cancellationToken)
                .ConfigureAwait(false);

                _rst = await rstSubscription.ReceiveAsync(cancellationToken)
                       .ConfigureAwait(false);

                _windowUpdate =
                    await windowUpdateSubscription
                    .ReceiveAsync(cancellationToken)
                    .ConfigureAwait(false);
            }
示例#8
0
文件: SpdyStream.cs 项目: lulzzz/Port
        public void Dispose()
        {
            if (Local.IsOpen)
            {
                Send(RstStream.Cancel(Id));
            }
            else
            {
                CloseLocal();
            }

            if (Remote.IsOpen)
            {
                CloseRemote();
            }

            _frameAvailable.Dispose();
            _windowSizeGate.Dispose();
            _local.Dispose();
            _remote.Dispose();
        }
示例#9
0
            protected override async Task WhenAsync(
                CancellationToken cancellationToken)
            {
                var dataSubscription = Server.On <Data>();
                var sendingTask      = _stream.SendLastAsync(
                    Encoding.UTF8.GetBytes(
                        "This is more than 5 bytes"),
                    cancellationToken: cancellationToken)
                                       .ConfigureAwait(false);

                _receivedData = await dataSubscription.ReceiveAsync(cancellationToken)
                                .ConfigureAwait(false);

                var rstSubscription = Server.On <RstStream>();

                _stream.Dispose();
                _rst = await rstSubscription.ReceiveAsync(cancellationToken)
                       .ConfigureAwait(false);

                _sendingResult = await sendingTask;
            }
示例#10
0
 private ReadResult(RstStream error)
 {
     _result = null;
     _error  = error;
 }
示例#11
0
 protected override Task GivenAsync(CancellationToken cancellationToken)
 {
     _frame = RstStream.Cancel(
         UInt31.From(123));
     return(Task.CompletedTask);
 }