Skip to content
Merged
Next Next commit
Allow switching execution profiles using env vars
  • Loading branch information
rzikm committed Feb 26, 2024
commit 74575d4eb1e86f1a34d0d0fa61143320c636136c
1 change: 1 addition & 0 deletions src/libraries/System.Net.Quic/src/System.Net.Quic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@

<ItemGroup>
<Reference Include="Microsoft.Win32.Primitives" />
<Reference Include="System.Console" />
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" />
<Reference Include="System.Collections.NonGeneric" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,23 @@ private MsQuicApi(QUIC_API_TABLE* apiTable)

fixed (byte* pAppName = "System.Net.Quic"u8)
{

QUIC_EXECUTION_PROFILE profile = QUIC_EXECUTION_PROFILE.LOW_LATENCY;

if (Environment.GetEnvironmentVariable("DOTNET_QUIC_EXECUTION_PROFILE") is string p)
{
if (Enum.TryParse(p, out QUIC_EXECUTION_PROFILE newProfile))
{
profile = newProfile;
}
}

System.Console.WriteLine($"Execution profile: {profile}");

var cfg = new QUIC_REGISTRATION_CONFIG
{
AppName = (sbyte*)pAppName,
ExecutionProfile = QUIC_EXECUTION_PROFILE.LOW_LATENCY
ExecutionProfile = profile
};

QUIC_HANDLE* handle;
Expand Down