Response headers don't need to be queued before subsequent write
This commit is contained in:
parent
c0728edda7
commit
f6dc72544c
|
|
@ -250,7 +250,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
|
|
||||||
public void Write(ArraySegment<byte> data, Action<Exception, object> callback, object state)
|
public void Write(ArraySegment<byte> data, Action<Exception, object> callback, object state)
|
||||||
{
|
{
|
||||||
ProduceStart();
|
ProduceStart(immediate: false);
|
||||||
SocketOutput.Write(data, callback, state);
|
SocketOutput.Write(data, callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +293,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProduceStart()
|
public void ProduceStart(bool immediate = true)
|
||||||
{
|
{
|
||||||
if (_resultStarted) return;
|
if (_resultStarted) return;
|
||||||
_resultStarted = true;
|
_resultStarted = true;
|
||||||
|
|
@ -315,7 +315,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
}
|
}
|
||||||
((IDisposable)x).Dispose();
|
((IDisposable)x).Dispose();
|
||||||
},
|
},
|
||||||
responseHeader.Item2);
|
responseHeader.Item2,
|
||||||
|
immediate: immediate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProduceEnd(Exception ex)
|
public void ProduceEnd(Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISocketOutput
|
public interface ISocketOutput
|
||||||
{
|
{
|
||||||
void Write(ArraySegment<byte> buffer, Action<Exception, object> callback, object state);
|
void Write(ArraySegment<byte> buffer, Action<Exception, object> callback, object state, bool immediate = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
_callbacksPending = new Queue<CallbackContext>();
|
_callbacksPending = new Queue<CallbackContext>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Write(ArraySegment<byte> buffer, Action<Exception, object> callback, object state)
|
public void Write(ArraySegment<byte> buffer, Action<Exception, object> callback, object state, bool immediate)
|
||||||
{
|
{
|
||||||
//TODO: need buffering that works
|
//TODO: need buffering that works
|
||||||
var copy = new byte[buffer.Count];
|
var copy = new byte[buffer.Count];
|
||||||
|
|
@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_writesPending < _maxPendingWrites)
|
if (_writesPending < _maxPendingWrites && immediate)
|
||||||
{
|
{
|
||||||
ScheduleWrite();
|
ScheduleWrite();
|
||||||
_writesPending++;
|
_writesPending++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue