未验证 提交 8a4de2eb 编写于 作者: R Radek Zikmund 提交者: GitHub

Update MsQuic and use ConnectionCloseStatus in StreamShutdown (#73563)

* Update MsQuic and use ConnectionCloseStatus in StreamShutdown

* Require MsQuic 2.1.*

* Add a few comments
上级 bbcc0ab7
......@@ -17,7 +17,7 @@ internal sealed unsafe class MsQuicApi
{
private static readonly Version MinWindowsVersion = new Version(10, 0, 20145, 1000);
private static readonly Version MsQuicVersion = new Version(2, 0);
private static readonly Version MsQuicVersion = new Version(2, 1);
public MsQuicSafeHandle Registration { get; }
......
......@@ -76,6 +76,7 @@ internal enum QUIC_CREDENTIAL_FLAGS
USE_SYSTEM_MAPPER = 0x00010000,
CACHE_ONLY_URL_RETRIEVAL = 0x00020000,
REVOCATION_CHECK_CACHE_ONLY = 0x00040000,
INPROC_PEER_CERTIFICATE = 0x00080000,
}
[System.Flags]
......@@ -424,6 +425,7 @@ internal enum QUIC_CIPHER_SUITE
internal enum QUIC_CONGESTION_CONTROL_ALGORITHM
{
CUBIC,
BBR,
MAX,
}
......@@ -2481,6 +2483,9 @@ internal byte RESERVED
[NativeTypeName("QUIC_UINT62")]
internal ulong ConnectionErrorCode;
[NativeTypeName("HRESULT")]
internal int ConnectionCloseStatus;
}
internal partial struct _IDEAL_SEND_BUFFER_SIZE_e__Struct
......@@ -2782,6 +2787,9 @@ internal static unsafe partial class MsQuic
[NativeTypeName("#define QUIC_PARAM_STREAM_PRIORITY 0x08000003")]
internal const uint QUIC_PARAM_STREAM_PRIORITY = 0x08000003;
[NativeTypeName("#define QUIC_PARAM_STREAM_STATISTICS 0X08000004")]
internal const uint QUIC_PARAM_STREAM_STATISTICS = 0X08000004;
[NativeTypeName("#define QUIC_API_VERSION_2 2")]
internal const uint QUIC_API_VERSION_2 = 2;
}
......
......@@ -537,12 +537,14 @@ private unsafe int HandleEventShutdownComplete(ref SHUTDOWN_COMPLETE data)
(shutdownByApp: true, closedRemotely: true) => ThrowHelper.GetConnectionAbortedException((long)data.ConnectionErrorCode),
// It's local shutdown by app, this side called QuicConnection.CloseAsync, throw QuicError.OperationAborted.
(shutdownByApp: true, closedRemotely: false) => ThrowHelper.GetOperationAbortedException(),
// It's remote shutdown by transport, (TODO: we should propagate transport error code), throw QuicError.InternalError.
// It's remote shutdown by transport, we received a CONNECTION_CLOSE frame with a QUIC transport error code
// TODO: we should propagate the transport error code
// https://github.com/dotnet/runtime/issues/72666
(shutdownByApp: false, closedRemotely: true) => ThrowHelper.GetExceptionForMsQuicStatus(QUIC_STATUS_INTERNAL_ERROR, $"Shutdown by transport {data.ConnectionErrorCode}"),
// It's local shutdown by transport, assuming idle connection (TODO: we should get Connection.CloseStatus), throw QuicError.ConnectionIdle.
(shutdownByApp: false, closedRemotely: true) => ThrowHelper.GetExceptionForMsQuicStatus(data.ConnectionCloseStatus, $"Shutdown by transport {data.ConnectionErrorCode}"),
// It's local shutdown by transport, due to some timeout
// TODO: we should propagate transport error code
// https://github.com/dotnet/runtime/issues/72666
(shutdownByApp: false, closedRemotely: false) => ThrowHelper.GetExceptionForMsQuicStatus(QUIC_STATUS_CONNECTION_IDLE),
(shutdownByApp: false, closedRemotely: false) => ThrowHelper.GetExceptionForMsQuicStatus(data.ConnectionCloseStatus),
};
_startedTcs.TrySetException(exception);
_receiveTcs.TrySetException(exception, final: true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册