Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUIC] Improved logic of listener AcceptConnection #82261

Merged
merged 4 commits into from
Feb 20, 2023
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
5 changes: 4 additions & 1 deletion src/libraries/System.Net.Quic/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@
<data name="net_quic_timeout" xml:space="preserve">
<value>Connection timed out waiting for a response from the peer.</value>
</data>
<data name="net_quic_handshake_timeout" xml:space="preserve">
<value>Connection handshake was canceled due to the configured timeout of {0} seconds elapsing.</value>
</data>
<data name="net_quic_ssl_option" xml:space="preserve">
<value>'{0}' is not supported by System.Net.Quic.</value>
</data>
Expand Down Expand Up @@ -220,7 +223,7 @@
<value>Binding to socket failed, likely caused by a family mismatch between local and remote address.</value>
</data>
<data name="net_quic_auth" xml:space="preserve">
<value>Authentication failed. {0}</value>
<value>Authentication failed: {0}.</value>
</data>
<!-- Same as in System.Net.Security -->
<data name="net_io_invalidnestedcall" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public async ValueTask<QuicStream> AcceptInboundStreamAsync(CancellationToken ca
}
catch (ChannelClosedException ex) when (ex.InnerException is not null)
{
ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
ExceptionDispatchInfo.Throw(ex.InnerException);
throw;
}
finally
Expand Down Expand Up @@ -608,7 +608,7 @@ private static unsafe int NativeCallback(QUIC_HANDLE* connection, void* context,
}

/// <summary>
/// If not closed explicitly by <see cref="CloseAsync(long, CancellationToken)" />, closes the connection silently (leading to idle timeout on the peer side).
/// If not closed explicitly by <see cref="CloseAsync(long, CancellationToken)" />, closes the connection with the <see cref="QuicConnectionOptions.DefaultCloseErrorCode"/>.
/// And releases all resources associated with the connection.
/// </summary>
/// <returns>A task that represents the asynchronous dispose operation.</returns>
Expand All @@ -619,7 +619,7 @@ public async ValueTask DisposeAsync()
return;
}

// Check if the connection has been shut down and if not, shut it down silently.
// Check if the connection has been shut down and if not, shut it down.
if (_shutdownTcs.TryInitialize(out ValueTask valueTask, this))
{
unsafe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ internal static partial class QuicDefaults
/// Max value for application error codes that can be sent by QUIC, see <see href="https://www.rfc-editor.org/rfc/rfc9000.html#integer-encoding"/>.
/// </summary>
public const long MaxErrorCodeValue = (1L << 62) - 1;

/// <summary>
/// Our own imposed timeout in the handshake process, since in certain cases MsQuic will not impose theirs, see <see href="https://github.com/microsoft/msquic/discussions/2705"/>.
/// </summary>
public static readonly TimeSpan HandshakeTimeout = TimeSpan.FromSeconds(10);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ public sealed class QuicException : IOException
/// <param name="applicationErrorCode">The application protocol error code associated with the error.</param>
/// <param name="message">The message for the exception.</param>
public QuicException(QuicError error, long? applicationErrorCode, string message)
: base(message)
: this(error, applicationErrorCode, message, null)
{ }

/// <summary>
/// Initializes a new instance of the <see cref='QuicException'/> class.
/// </summary>
/// <param name="error">The error associated with the exception.</param>
/// <param name="applicationErrorCode">The application protocol error code associated with the error.</param>
/// <param name="message">The message for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
internal QuicException(QuicError error, long? applicationErrorCode, string message, Exception? innerException)
: base(message, innerException)
{
QuicError = error;
ApplicationErrorCode = applicationErrorCode;
Expand Down

This file was deleted.

Loading