Guarding against more read_cb cases
This commit is contained in:
parent
9c1cb29cdd
commit
21778f631a
|
|
@ -19,12 +19,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SampleApp", "samples\Sample
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Kestrel", "src\Kestrel\Kestrel.kproj", "{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Kestrel", "src\Kestrel\Kestrel.kproj", "{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Mvc.Modules", "..\Entropy\samples\Mvc.Modules\Mvc.Modules.kproj", "{181C52C4-E916-416E-96BA-2B645841807F}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.RequestContainer", "..\Hosting\src\Microsoft.AspNet.RequestContainer\Microsoft.AspNet.RequestContainer.kproj", "{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Hosting", "..\Hosting\src\Microsoft.AspNet.Hosting\Microsoft.AspNet.Hosting.kproj", "{3944F036-7E75-47E8-AA52-C4B89A64EC3A}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(Performance) = preSolution
|
GlobalSection(Performance) = preSolution
|
||||||
HasPerformanceSessions = true
|
HasPerformanceSessions = true
|
||||||
|
|
@ -50,18 +44,6 @@ Global
|
||||||
{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{30B7617E-58EF-4382-B3EA-5B2E718CF1A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{181C52C4-E916-416E-96BA-2B645841807F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{181C52C4-E916-416E-96BA-2B645841807F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{181C52C4-E916-416E-96BA-2B645841807F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{181C52C4-E916-416E-96BA-2B645841807F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{374A5B0C-3E93-4A23-A4A0-EE2AB6DF7814}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{3944F036-7E75-47E8-AA52-C4B89A64EC3A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
|
|
@ -80,26 +80,39 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
2048);
|
2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRead(UvStreamHandle handle, int nread, Exception error)
|
private void OnRead(UvStreamHandle handle, int status, Exception error)
|
||||||
{
|
{
|
||||||
SocketInput.Unpin(nread);
|
SocketInput.Unpin(status);
|
||||||
|
|
||||||
if (nread == 0 || error != null)
|
var normalRead = error == null && status > 0;
|
||||||
|
var normalDone = status == 0 || status == -4077 || status == -4095;
|
||||||
|
var errorDone = !(normalDone || normalRead);
|
||||||
|
|
||||||
|
if (normalRead)
|
||||||
|
{
|
||||||
|
KestrelTrace.Log.ConnectionRead(_connectionId, status);
|
||||||
|
}
|
||||||
|
else if (normalDone || errorDone)
|
||||||
{
|
{
|
||||||
SocketInput.RemoteIntakeFin = true;
|
|
||||||
KestrelTrace.Log.ConnectionReadFin(_connectionId);
|
KestrelTrace.Log.ConnectionReadFin(_connectionId);
|
||||||
|
|
||||||
if (error != null)
|
SocketInput.RemoteIntakeFin = true;
|
||||||
|
|
||||||
|
if (errorDone && error != null)
|
||||||
{
|
{
|
||||||
Trace.WriteLine("Connection.OnRead " + error.ToString());
|
Trace.WriteLine("Connection.OnRead " + error.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
KestrelTrace.Log.ConnectionRead(_connectionId, nread);
|
|
||||||
}
|
|
||||||
|
|
||||||
_frame.Consume();
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_frame.Consume();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Trace.WriteLine("Connection._frame.Consume " + ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IConnectionControl.Pause()
|
void IConnectionControl.Pause()
|
||||||
|
|
|
||||||
|
|
@ -90,16 +90,24 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
|
|
||||||
Buffer = new ArraySegment<byte>(Buffer.Array, Buffer.Offset, Buffer.Count + count);
|
Buffer = new ArraySegment<byte>(Buffer.Array, Buffer.Offset, Buffer.Count + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntPtr Pin(int minimumSize)
|
public IntPtr Pin(int minimumSize)
|
||||||
{
|
{
|
||||||
var segment = Available(minimumSize);
|
var segment = Available(minimumSize);
|
||||||
_gcHandle = GCHandle.Alloc(segment.Array, GCHandleType.Pinned);
|
_gcHandle = GCHandle.Alloc(segment.Array, GCHandleType.Pinned);
|
||||||
return _gcHandle.AddrOfPinnedObject() + segment.Offset;
|
return _gcHandle.AddrOfPinnedObject() + segment.Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Unpin(int count)
|
public void Unpin(int count)
|
||||||
{
|
{
|
||||||
_gcHandle.Free();
|
// read_cb may called without an earlier alloc_cb
|
||||||
Extend(count);
|
// this does not need to be thread-safe
|
||||||
|
// IsAllocated is checked only because Unpin can be called redundantly
|
||||||
|
if (_gcHandle.IsAllocated)
|
||||||
|
{
|
||||||
|
_gcHandle.Free();
|
||||||
|
Extend(count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,17 @@
|
||||||
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
|
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"net45": { },
|
"net45": {
|
||||||
|
"compilationOptions": {
|
||||||
|
"define": [ "TRACE", "NET45" ],
|
||||||
|
"allowUnsafe": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"k10": {
|
"k10": {
|
||||||
|
"compilationOptions": {
|
||||||
|
"define": [ "TRACE", "K10" ],
|
||||||
|
"allowUnsafe": true
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Threading.ThreadPool": "4.0.10.0",
|
"System.Threading.ThreadPool": "4.0.10.0",
|
||||||
"System.Diagnostics.Debug": "4.0.10.0",
|
"System.Diagnostics.Debug": "4.0.10.0",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue