< Summary

Information
Class: IceRpc.ServerOptions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/ServerOptions.cs
Tag: 1856_27024993493
Line coverage
91%
Covered lines: 22
Uncovered lines: 2
Coverable lines: 24
Total lines: 76
Line coverage: 91.6%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
Method coverage
91%
Covered methods: 11
Fully covered methods: 11
Total methods: 12
Method coverage: 91.6%
Full method coverage: 91.6%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ConnectionOptions()100%11100%
get_ConnectTimeout()100%11100%
set_ConnectTimeout(...)50%22100%
get_MaxConnections()100%11100%
set_MaxConnections(...)100%22100%
get_MaxPendingConnections()100%11100%
set_MaxPendingConnections(...)100%22100%
get_ServerAddress()100%11100%
get_ServerAuthenticationOptions()100%11100%
get_ShutdownTimeout()100%11100%
set_ShutdownTimeout(...)0%620%
.ctor()100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/ServerOptions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Net.Security;
 4
 5namespace IceRpc;
 6
 7/// <summary>Represents a property bag used to configure a <see cref="Server" />.</summary>
 8public sealed record class ServerOptions
 9{
 10    /// <summary>Gets or sets the connection options for server connections.</summary>
 11    /// <value>The connection options. Defaults to a default constructed <see cref="ConnectionOptions" />.</value>
 70412    public ConnectionOptions ConnectionOptions { get; set; } = new();
 13
 14    /// <summary>Gets or sets the connection establishment timeout for connections accepted by the server.</summary>
 15    /// <value>Defaults to <c>10</c> seconds.</value>
 16    public TimeSpan ConnectTimeout
 17    {
 16218        get => _connectTimeout;
 319        set => _connectTimeout = value != TimeSpan.Zero ? value :
 320            throw new ArgumentException($"0 is not a valid value for {nameof(ConnectTimeout)}", nameof(value));
 21    }
 22
 23    /// <summary>Gets or sets the maximum number of accepted server connections. Once the maximum number of connections
 24    /// has been reached, the server will refuse any new connections.</summary>
 25    /// <value>The maximum number of connections. Defaults to <c>0</c>, meaning unlimited.</value>
 26    public int MaxConnections
 27    {
 9428        get => _maxConnections;
 929        set => _maxConnections = value >= 0 ? value :
 930            throw new ArgumentOutOfRangeException(
 931                nameof(value),
 932                value,
 933                $"{nameof(MaxConnections)} must be greater than or equal to 0 (where 0 means unlimited).");
 34    }
 35
 36    /// <summary>Gets or sets the maximum number of server connections waiting for connection establishment to complete.
 37    /// Once the maximum number of pending connections has been reached, the server will stop accepting new connections
 38    /// to ensure that the transport rejects new connections once its connection backlog is full.</summary>
 39    /// <value>The maximum number of connection waiting for connection establishment to complete. Defaults to
 40    /// <c>100</c>.</value>
 41    public int MaxPendingConnections
 42    {
 9443        get => _maxPendingConnections;
 444        set => _maxPendingConnections = value > 0 ? value :
 445            throw new ArgumentOutOfRangeException(
 446                nameof(value),
 447                value,
 448                $"{nameof(MaxPendingConnections)} must be greater than 0.");
 49    }
 50
 51    /// <summary>Gets or sets the server's address. The server address host is usually an IP address, and it cannot be a
 52    /// DNS name.</summary>
 53    /// <value>The <see cref="ServerAddress" /> of this <see cref="Server" />. Defaults to a <see cref="ServerAddress"
 54    /// /> constructed with <see cref="Protocol.IceRpc" />.</value>
 28655    public ServerAddress ServerAddress { get; set; } = new(Protocol.IceRpc);
 56
 57    /// <summary>Gets or sets the SSL server authentication options.</summary>
 58    /// <value>The SSL server authentication options. When not <see langword="null" />, the server will accept only
 59    /// secure connections.</value>
 22260    public SslServerAuthenticationOptions? ServerAuthenticationOptions { get; set; }
 61
 62    /// <summary>Gets or sets the shutdown timeout. This timeout is used when gracefully shutting down a connection
 63    /// managed by the server.</summary>
 64    /// <value>Defaults to <c>10</c> seconds.</value>
 65    public TimeSpan ShutdownTimeout
 66    {
 9467        get => _shutdownTimeout;
 068        set => _shutdownTimeout = value != TimeSpan.Zero ? value :
 069            throw new ArgumentException($"0 is not a valid value for {nameof(ShutdownTimeout)}", nameof(value));
 70    }
 71
 9972    private TimeSpan _connectTimeout = TimeSpan.FromSeconds(10);
 73    private int _maxConnections;
 9974    private int _maxPendingConnections = 100;
 9975    private TimeSpan _shutdownTimeout = TimeSpan.FromSeconds(10);
 76}