ServicePointHelpers
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
namespace System.ClientModel.Internal
{
internal static class ServicePointHelpers
{
private const int RuntimeDefaultConnectionLimit = 2;
private const int IncreasedConnectionLimit = 50;
private const int IncreasedConnectionLeaseTimeout = 300000;
private static TimeSpan DefaultConnectionLeaseTimeoutTimeSpan = Timeout.InfiniteTimeSpan;
private static TimeSpan IncreasedConnectionLeaseTimeoutTimeSpan = TimeSpan.FromMilliseconds(300000);
[System.Runtime.CompilerServices.NullableContext(1)]
public static void SetLimits(HttpMessageHandler messageHandler)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")))
try {
HttpClientHandler httpClientHandler = messageHandler as HttpClientHandler;
if (httpClientHandler != null && httpClientHandler.MaxConnectionsPerServer == 2)
httpClientHandler.MaxConnectionsPerServer = 50;
} catch (NotSupportedException) {
} catch (NotImplementedException) {
}
}
}
}