< Summary

Information
Class: IceRpc.Transports.Quic.QuicServerTransportOptions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Quic/QuicTransportOptions.cs
Tag: 592_20856082467
Line coverage
33%
Covered lines: 2
Uncovered lines: 4
Coverable lines: 6
Total lines: 70
Line coverage: 33.3%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage
66%
Covered methods: 2
Total methods: 3
Method coverage: 66.6%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ListenBacklog()100%11100%
set_ListenBacklog(...)0%620%
.ctor()100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Quic/QuicTransportOptions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Net;
 4using System.Net.Quic;
 5using System.Runtime.Versioning;
 6
 7namespace IceRpc.Transports.Quic;
 8
 9/// <summary>The base options class for QUIC transports.</summary>
 10[SupportedOSPlatform("linux")]
 11[SupportedOSPlatform("macos")]
 12[SupportedOSPlatform("windows")]
 13public record class QuicTransportOptions
 14{
 15    /// <summary>Gets or sets the idle timeout. This timeout is used to monitor the transport connection health. If no
 16    /// data is received within the idle timeout period, the transport connection is aborted.</summary>
 17    /// <value>The idle timeout. Defaults to 30 seconds. <see cref="TimeSpan.Zero" /> means "use the default value
 18    /// provided by the underlying implementation".</value>
 19    /// <remarks>The idle timeout is negotiated by QUIC during connection establishment. The actual idle timeout value
 20    /// for a connection can be lower than the value you've set here.</remarks>
 21    public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(30);
 22
 23    /// <summary>Gets or sets the initial receive window sizes for the connection and individual stream types.
 24    /// </summary>
 25    /// <value>The initial receive window sizes.</value>
 26    public QuicReceiveWindowSizes InitialReceiveWindowSizes { get; set; } = new();
 27}
 28
 29/// <summary>The options class for configuring <see cref="QuicClientTransport"/>.</summary>
 30public sealed record class QuicClientTransportOptions : QuicTransportOptions
 31{
 32    /// <summary>Gets or sets the address and port represented by a .NET <see cref="IPEndPoint"/> to use for a client
 33    /// QUIC connection. If specified the client QUIC connection will bind to this address and port before connection
 34    /// establishment.</summary>
 35    /// <value>The address and port to bind to. Defaults to <see langword="null" />.</value>
 36    public IPEndPoint? LocalNetworkAddress { get; set; }
 37
 38    /// <summary>Gets or sets the interval at which the client sends QUIC PING frames to the server to keep the
 39    /// connection alive.</summary>
 40    /// <value>The keep-alive interval. Defaults to 15 seconds. <see cref="TimeSpan.Zero" /> means: use the default
 41    /// value provided by the underlying implementation. <see cref="Timeout.InfiniteTimeSpan" /> means: never send
 42    /// PING frames.</value>
 43    /// <remarks>Unlike the idle timeout, the keep-alive interval is not negotiated during connection establishment. We
 44    /// recommend setting this interval at half the negotiated idle timeout value to keep a healthy connection alive
 45    /// forever - really until it's closed due to inactivity at the RPC level via the
 46    /// <see cref="ConnectionOptions.InactivityTimeout" />.
 47    /// This option is a stop-gap: ideally the .NET QUIC implementation would provide a way to automatically send PING
 48    /// frames to keep the connection alive based on the negotiated idle timeout. See
 49    /// <see href="https://github.com/microsoft/msquic/issues/3880" />.</remarks>
 50    public TimeSpan KeepAliveInterval { get; set; } = TimeSpan.FromSeconds(15);
 51}
 52
 53/// <summary>The options class for configuring <see cref="QuicServerTransport"/>.</summary>
 54public sealed record class QuicServerTransportOptions : QuicTransportOptions
 55{
 56    /// <summary>Gets or sets the length of the server listen queue for accepting new connections. If a new connection
 57    /// request arrives and the queue is full, the client connection establishment will fail with a <see
 58    /// cref="IceRpcException"/> and the <see cref="IceRpcError.ConnectionRefused"/> error code.</summary>
 59    /// <value>The server listen backlog size. Defaults to <c>511</c>.</value>
 60    public int ListenBacklog
 61    {
 12362        get => _listenBacklog;
 063        set => _listenBacklog = value > 0 ? value :
 064            throw new ArgumentOutOfRangeException(
 065                nameof(value),
 066                $"Invalid value '{value}' for {nameof(ListenBacklog)}, it cannot be less than 1.");
 67    }
 68
 12469    private int _listenBacklog = 511;
 70}