From 62ec11be7ef3bfcf340e02b06b034adddae67e45 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Fri, 24 Jul 2015 15:43:43 -0700 Subject: [PATCH] Adding internal Constants class --- src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs | 3 ++- .../Http/ListenerPrimary.cs | 3 ++- .../Infrastructure/Constants.cs | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/Microsoft.AspNet.Server.Kestrel/Infrastructure/Constants.cs diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs index 64fca769dc..66a1028c3c 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Http/Listener.cs @@ -1,6 +1,7 @@ // 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 Microsoft.AspNet.Server.Kestrel.Infrastructure; using Microsoft.AspNet.Server.Kestrel.Networking; using System; using System.Diagnostics; @@ -53,7 +54,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http ListenSocket = new UvTcpHandle(); ListenSocket.Init(Thread.Loop, Thread.QueueCloseHandle); ListenSocket.Bind(new IPEndPoint(IPAddress.Any, port)); - ListenSocket.Listen(128, _connectionCallback, this); + ListenSocket.Listen(Constants.ListenBacklog, _connectionCallback, this); tcs.SetResult(0); } catch (Exception ex) diff --git a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs index 2de5c44ce5..fb2e9dec6c 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/Http/ListenerPrimary.cs @@ -1,6 +1,7 @@ // 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 Microsoft.AspNet.Server.Kestrel.Infrastructure; using Microsoft.AspNet.Server.Kestrel.Networking; using System; using System.Collections.Generic; @@ -35,7 +36,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http ListenPipe = new UvPipeHandle(); ListenPipe.Init(Thread.Loop, false); ListenPipe.Bind(pipeName); - ListenPipe.Listen(128, OnListenPipe, null); + ListenPipe.Listen(Constants.ListenBacklog, OnListenPipe, null); }, null); } diff --git a/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/Constants.cs b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/Constants.cs new file mode 100644 index 0000000000..48d6dc93e9 --- /dev/null +++ b/src/Microsoft.AspNet.Server.Kestrel/Infrastructure/Constants.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Microsoft.AspNet.Server.Kestrel.Infrastructure +{ + internal class Constants + { + public const int ListenBacklog = 128; + } +}