Move ECONNRESET value check to server initialization.

This commit is contained in:
Cesar Blum Silveira 2016-05-18 22:11:10 -07:00
parent 7e7f21ec49
commit 9a06bf39ab
3 changed files with 6 additions and 10 deletions

View File

@ -40,8 +40,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
private ConnectionState _connectionState;
private TaskCompletionSource<object> _socketClosedTcs;
bool _eConnResetChecked = false;
public Connection(ListenerContext context, UvStreamHandle socket) : base(context)
{
_socket = socket;
@ -202,7 +200,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
if (_socketClosedTcs != null)
{
// This is always waited on synchronously, so it's safe to
// call on the libuv thread.
// call on the libuv thread.
_socketClosedTcs.TrySetResult(null);
}
}
@ -274,12 +272,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
return;
}
if (!_eConnResetChecked && !Constants.ECONNRESET.HasValue)
{
Log.LogWarning("Unable to determine ECONNRESET value on this platform.");
_eConnResetChecked = true;
}
var normalRead = status > 0;
var normalDone = status == Constants.ECONNRESET || status == Constants.EOF;
var errorDone = !(normalDone || normalRead);

View File

@ -1,7 +1,6 @@
// 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.
using System;
using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure

View File

@ -94,6 +94,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel
"ThreadCount must be positive.");
}
if (!Constants.ECONNRESET.HasValue)
{
_logger.LogWarning("Unable to determine ECONNRESET value on this platform.");
}
engine.Start(threadCount);
var atLeastOneListener = false;