From c4690bfaf352b8ca31f821c44757ded263c1e8e5 Mon Sep 17 00:00:00 2001
From: William Godbe <wigodbe@microsoft.com>
Date: Thu, 12 Aug 2021 17:35:52 -0700
Subject: [PATCH] Add Backlog to QuicTransportOptions (#35312)

---
 .../Transport.Quic/src/Internal/QuicConnectionListener.cs    | 1 +
 .../Kestrel/Transport.Quic/src/PublicAPI.Unshipped.txt       | 2 ++
 .../Kestrel/Transport.Quic/src/QuicTransportOptions.cs       | 5 +++++
 3 files changed, 8 insertions(+)

diff --git a/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs b/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs
index 9a9528bc04a..38e9b26a193 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs
+++ b/src/Servers/Kestrel/Transport.Quic/src/Internal/QuicConnectionListener.cs
@@ -58,6 +58,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal
             quicListenerOptions.IdleTimeout = options.IdleTimeout;
             quicListenerOptions.MaxBidirectionalStreams = options.MaxBidirectionalStreamCount;
             quicListenerOptions.MaxUnidirectionalStreams = options.MaxUnidirectionalStreamCount;
+            quicListenerOptions.ListenBacklog = options.Backlog;
 
             _listener = new QuicListener(quicListenerOptions);
 
diff --git a/src/Servers/Kestrel/Transport.Quic/src/PublicAPI.Unshipped.txt b/src/Servers/Kestrel/Transport.Quic/src/PublicAPI.Unshipped.txt
index 4ab5cd10661..3abb58e9da0 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/PublicAPI.Unshipped.txt
+++ b/src/Servers/Kestrel/Transport.Quic/src/PublicAPI.Unshipped.txt
@@ -26,6 +26,8 @@
 *REMOVED*~static Microsoft.AspNetCore.Hosting.WebHostBuilderMsQuicExtensions.UseQuic(this Microsoft.AspNetCore.Hosting.IWebHostBuilder hostBuilder) -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
 Microsoft.AspNetCore.Hosting.WebHostBuilderQuicExtensions
 Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions
+Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.Backlog.get -> int
+Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.Backlog.set -> void
 Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.IdleTimeout.get -> System.TimeSpan
 Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.IdleTimeout.set -> void
 Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.MaxBidirectionalStreamCount.get -> ushort
diff --git a/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs b/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs
index 5041b274b94..0a1396a842f 100644
--- a/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs
+++ b/src/Servers/Kestrel/Transport.Quic/src/QuicTransportOptions.cs
@@ -40,6 +40,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Quic
         /// </summary>
         public long? MaxWriteBufferSize { get; set; } = 64 * 1024;
 
+        /// <summary>
+        /// The maximum length of the pending connection queue.
+        /// </summary>
+        public int Backlog { get; set; } = 512;
+
         internal ISystemClock SystemClock = new SystemClock();
     }
 }
-- 
GitLab