From 2527face168cd24d5a9d685bbbbfdd9b26898ada Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 16 Mar 2018 02:55:51 -0400 Subject: [PATCH] Query EndPoints once during reset (#2398) --- src/Kestrel.Core/Internal/Http/HttpProtocol.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Kestrel.Core/Internal/Http/HttpProtocol.cs b/src/Kestrel.Core/Internal/Http/HttpProtocol.cs index 30679f525b..01bde85605 100644 --- a/src/Kestrel.Core/Internal/Http/HttpProtocol.cs +++ b/src/Kestrel.Core/Internal/Http/HttpProtocol.cs @@ -335,11 +335,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http _statusCode = StatusCodes.Status200OK; _reasonPhrase = null; - RemoteIpAddress = RemoteEndPoint?.Address; - RemotePort = RemoteEndPoint?.Port ?? 0; + var remoteEndPoint = RemoteEndPoint; + RemoteIpAddress = remoteEndPoint?.Address; + RemotePort = remoteEndPoint?.Port ?? 0; + + var localEndPoint = LocalEndPoint; + LocalIpAddress = localEndPoint?.Address; + LocalPort = localEndPoint?.Port ?? 0; - LocalIpAddress = LocalEndPoint?.Address; - LocalPort = LocalEndPoint?.Port ?? 0; ConnectionIdFeature = ConnectionId; HttpRequestHeaders.Reset();