Skip to content

Commit 6f80281

Browse files
Sync shared code from runtime (#24784)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 3dd75ea commit 6f80281

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/Shared/runtime/Quic/Interop/MsQuicStatusCodes.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Runtime.InteropServices;
5-
64
namespace System.Net.Quic.Implementations.MsQuic.Internal
75
{
86
internal static class MsQuicStatusCodes
97
{
10-
internal static readonly uint Success = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Windows.Success : Linux.Success;
11-
internal static readonly uint Pending = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Windows.Pending : Linux.Pending;
12-
internal static readonly uint InternalError = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Windows.InternalError : Linux.InternalError;
8+
internal static uint Success => OperatingSystem.IsWindows() ? Windows.Success : Linux.Success;
9+
internal static uint Pending => OperatingSystem.IsWindows() ? Windows.Pending : Linux.Pending;
10+
internal static uint InternalError => OperatingSystem.IsWindows() ? Windows.InternalError : Linux.InternalError;
1311

1412
// TODO return better error messages here.
15-
public static string GetError(uint status)
16-
{
17-
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
18-
? Windows.GetError(status) : Linux.GetError(status);
19-
}
13+
public static string GetError(uint status) => OperatingSystem.IsWindows() ? Windows.GetError(status) : Linux.GetError(status);
2014

2115
private static class Windows
2216
{

src/Shared/runtime/Quic/Interop/MsQuicStatusHelper.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Runtime.InteropServices;
5-
64
namespace System.Net.Quic.Implementations.MsQuic.Internal
75
{
86
internal static class MsQuicStatusHelper
97
{
108
internal static bool SuccessfulStatusCode(uint status)
119
{
12-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
10+
if (OperatingSystem.IsWindows())
1311
{
1412
return status < 0x80000000;
1513
}
1614

17-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
15+
if (OperatingSystem.IsLinux())
1816
{
1917
return (int)status <= 0;
2018
}

0 commit comments

Comments
 (0)