parent
7e7f21ec49
commit
e8647c0cb4
|
|
@ -73,6 +73,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
|
||||
}
|
||||
|
||||
public IFrameControl FrameControl { get; set; }
|
||||
|
||||
string IHttpRequestFeature.Protocol
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ using Microsoft.Extensions.Primitives;
|
|||
|
||||
namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||
{
|
||||
public abstract partial class Frame : FrameContext, IFrameControl
|
||||
public abstract partial class Frame : ConnectionContext, IFrameControl
|
||||
{
|
||||
private static readonly Encoding _ascii = Encoding.ASCII;
|
||||
private static readonly ArraySegment<byte> _endChunkedResponseBytes = CreateAsciiByteArraySegment("0\r\n\r\n");
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||
{
|
||||
public class FrameContext : ConnectionContext
|
||||
{
|
||||
public FrameContext()
|
||||
{
|
||||
}
|
||||
|
||||
public FrameContext(ConnectionContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public IFrameControl FrameControl { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
{
|
||||
class FrameResponseStream : Stream
|
||||
{
|
||||
private FrameContext _context;
|
||||
private IFrameControl _frameControl;
|
||||
private FrameStreamState _state;
|
||||
|
||||
public FrameResponseStream()
|
||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
{
|
||||
ValidateState(default(CancellationToken));
|
||||
|
||||
_context.FrameControl.Flush();
|
||||
_frameControl.Flush();
|
||||
}
|
||||
|
||||
public override Task FlushAsync(CancellationToken cancellationToken)
|
||||
|
|
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
var task = ValidateState(cancellationToken);
|
||||
if (task == null)
|
||||
{
|
||||
return _context.FrameControl.FlushAsync(cancellationToken);
|
||||
return _frameControl.FlushAsync(cancellationToken);
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
{
|
||||
ValidateState(default(CancellationToken));
|
||||
|
||||
_context.FrameControl.Write(new ArraySegment<byte>(buffer, offset, count));
|
||||
_frameControl.Write(new ArraySegment<byte>(buffer, offset, count));
|
||||
}
|
||||
|
||||
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
var task = ValidateState(cancellationToken);
|
||||
if (task == null)
|
||||
{
|
||||
return _context.FrameControl.WriteAsync(new ArraySegment<byte>(buffer, offset, count), cancellationToken);
|
||||
return _frameControl.WriteAsync(new ArraySegment<byte>(buffer, offset, count), cancellationToken);
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
|
@ -134,14 +134,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
}
|
||||
}
|
||||
|
||||
public void Initialize(FrameContext context)
|
||||
public void Initialize(IFrameControl frameControl)
|
||||
{
|
||||
_context = context;
|
||||
_frameControl = frameControl;
|
||||
}
|
||||
|
||||
public void Uninitialize()
|
||||
{
|
||||
_context = null;
|
||||
_frameControl = null;
|
||||
_state = FrameStreamState.Closed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure
|
|||
ServerOptions = serverOptions;
|
||||
}
|
||||
|
||||
public Streams CreateStreams(FrameContext owner)
|
||||
public Streams CreateStreams(IFrameControl frameControl)
|
||||
{
|
||||
Streams streams;
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure
|
|||
streams = new Streams();
|
||||
}
|
||||
|
||||
streams.Initialize(owner);
|
||||
streams.Initialize(frameControl);
|
||||
|
||||
return streams;
|
||||
}
|
||||
|
|
@ -103,9 +103,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure
|
|||
DuplexStream = new FrameDuplexStream(RequestBody, ResponseBody);
|
||||
}
|
||||
|
||||
public void Initialize(FrameContext renter)
|
||||
public void Initialize(IFrameControl frameControl)
|
||||
{
|
||||
ResponseBody.Initialize(renter);
|
||||
ResponseBody.Initialize(frameControl);
|
||||
}
|
||||
|
||||
public void Uninitialize()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure
|
|||
{
|
||||
KestrelServerOptions ServerOptions { get; set; }
|
||||
|
||||
Streams CreateStreams(FrameContext owner);
|
||||
Streams CreateStreams(IFrameControl frameControl);
|
||||
|
||||
void DisposeStreams(Streams streams);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
|
|||
{
|
||||
var trace = new KestrelTrace(new TestKestrelTrace());
|
||||
var ltp = new LoggingThreadPool(trace);
|
||||
var context = new FrameContext()
|
||||
var context = new Frame<object>(null, new ConnectionContext() { ServerAddress = new ServerAddress() })
|
||||
{
|
||||
DateHeaderValueManager = new DateHeaderValueManager(),
|
||||
ServerAddress = ServerAddress.FromUrl("http://localhost:5000"),
|
||||
ConnectionControl = this,
|
||||
FrameControl = this
|
||||
};
|
||||
FrameContext = new Frame<object>(null, context);
|
||||
FrameContext = context;
|
||||
|
||||
_memoryPool = new MemoryPool();
|
||||
FrameContext.SocketInput = new SocketInput(_memoryPool, ltp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue