예제 #1
0
        protected Task SendPingAsync(Http2PingFrameFlags flags)
        {
            var pingFrame = new Http2Frame(Http2Limits.MinAllowedMaxFrameSize);

            pingFrame.PreparePing(flags);
            return(SendAsync(pingFrame.Raw));
        }
        protected Task SendPingAsync(Http2PingFrameFlags flags)
        {
            var pingFrame = new Http2Frame();

            pingFrame.PreparePing(flags);
            return(SendAsync(pingFrame.Raw));
        }
        internal Task SendPingAsync(Http2PingFrameFlags flags)
        {
            var outputWriter = _pair.Application.Output;
            var pingFrame    = new Http2Frame();

            pingFrame.PreparePing(flags);
            WriteHeader(pingFrame, outputWriter);
            return(SendAsync(new byte[8])); // Empty payload
        }
예제 #4
0
 public Task WritePingAsync(Http2PingFrameFlags flags, ReadOnlySpan <byte> payload)
 {
     lock (_writeLock)
     {
         _outgoingFrame.PreparePing(Http2PingFrameFlags.ACK);
         payload.CopyTo(_outgoingFrame.Payload);
         return(WriteAsync(_outgoingFrame.Raw));
     }
 }
예제 #5
0
        /* https://tools.ietf.org/html/rfc7540#section-6.7
         +---------------------------------------------------------------+
         |                                                               |
         |                      Opaque Data (64)                         |
         |                                                               |
         +---------------------------------------------------------------+
         */
        public Task WritePingAsync(Http2PingFrameFlags flags, ReadOnlySequence <byte> payload)
        {
            lock (_writeLock)
            {
                if (_completed)
                {
                    return(Task.CompletedTask);
                }

                _outgoingFrame.PreparePing(Http2PingFrameFlags.ACK);
                Debug.Assert(payload.Length == _outgoingFrame.PayloadLength); // 8
                WriteHeaderUnsynchronized();
                foreach (var segment in payload)
                {
                    _outputWriter.Write(segment.Span);
                }

                return(TimeFlushUnsynchronizedAsync());
            }
        }