Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/core/Azure.Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Fixed

- Fixed `NotSupportedException` when running in Unity.

## 1.16.0 (2021-06-30)

Expand Down
30 changes: 19 additions & 11 deletions sdk/core/Azure.Core/src/Pipeline/ServicePointHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ public static void SetLimits(HttpMessageHandler messageHandler)
return;
}

switch (messageHandler)
try
{
case HttpClientHandler httpClientHandler:
// Only change when the default runtime limit is used
if (httpClientHandler.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit)
{
httpClientHandler.MaxConnectionsPerServer = IncreasedConnectionLimit;
}
break;
switch (messageHandler)
{
case HttpClientHandler httpClientHandler:
// Only change when the default runtime limit is used
if (httpClientHandler.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit)
{
httpClientHandler.MaxConnectionsPerServer = IncreasedConnectionLimit;
}
break;
#if NETCOREAPP
case SocketsHttpHandler socketsHttpHandler:
if (socketsHttpHandler.MaxConnectionsPerServer == RuntimeDefaultConnectionLimit)
Expand All @@ -78,9 +80,15 @@ public static void SetLimits(HttpMessageHandler messageHandler)
}
break;
#endif
default:
Debug.Assert(false, "Unknown handler type");
break;
default:
Debug.Assert(false, "Unknown handler type");
break;
}
}
catch (NotSupportedException)
{
// Some platforms might throw NotSupportedException
// when accessing handler options
}
}
}
Expand Down