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 ConnectionState _connectionState;
private TaskCompletionSource<object> _socketClosedTcs; private TaskCompletionSource<object> _socketClosedTcs;
bool _eConnResetChecked = false;
public Connection(ListenerContext context, UvStreamHandle socket) : base(context) public Connection(ListenerContext context, UvStreamHandle socket) : base(context)
{ {
_socket = socket; _socket = socket;
@ -274,12 +272,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
return; return;
} }
if (!_eConnResetChecked && !Constants.ECONNRESET.HasValue)
{
Log.LogWarning("Unable to determine ECONNRESET value on this platform.");
_eConnResetChecked = true;
}
var normalRead = status > 0; var normalRead = status > 0;
var normalDone = status == Constants.ECONNRESET || status == Constants.EOF; var normalDone = status == Constants.ECONNRESET || status == Constants.EOF;
var errorDone = !(normalDone || normalRead); var errorDone = !(normalDone || normalRead);

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Extensions.PlatformAbstractions; using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure namespace Microsoft.AspNetCore.Server.Kestrel.Infrastructure

View File

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