| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using System.Net.Security; |
| | 4 | |
|
| | 5 | | namespace IceRpc; |
| | 6 | |
|
| | 7 | | /// <summary>Represents a property bag used to configure a <see cref="ClientConnection" />.</summary> |
| | 8 | | public sealed record class ClientConnectionOptions : ConnectionOptions |
| | 9 | | { |
| | 10 | | /// <summary>Gets or sets the SSL client authentication options.</summary> |
| | 11 | | /// <value>The SSL client authentication options. When not <see langword="null" />, |
| | 12 | | /// <see cref="ClientConnection.ConnectAsync(CancellationToken)" /> will either establish a secure connection or |
| | 13 | | /// fail.</value> |
| 200 | 14 | | public SslClientAuthenticationOptions? ClientAuthenticationOptions { get; set; } |
| | 15 | |
|
| | 16 | | /// <summary>Gets or sets the connection establishment timeout.</summary> |
| | 17 | | /// <value>The connection establishment timeout. Defaults to <c>10</c> seconds.</value> |
| | 18 | | public TimeSpan ConnectTimeout |
| | 19 | | { |
| 137 | 20 | | get => _connectTimeout; |
| 4 | 21 | | set => _connectTimeout = value != TimeSpan.Zero ? value : |
| 4 | 22 | | throw new ArgumentException($"0 is not a valid value for {nameof(ConnectTimeout)}", nameof(value)); |
| | 23 | | } |
| | 24 | |
|
| | 25 | | /// <summary>Gets or sets the connection's server address.</summary> |
| | 26 | | /// <value>The connections's server address. If <see langword="null" />, the client connection construction will |
| | 27 | | /// fail.</value> |
| 270 | 28 | | public ServerAddress? ServerAddress { get; set; } |
| | 29 | |
|
| | 30 | | /// <summary>Gets or sets the shutdown timeout.</summary> |
| | 31 | | /// <value>The shutdown timeout. Defaults to <c>10</c> seconds.</value> |
| | 32 | | public TimeSpan ShutdownTimeout |
| | 33 | | { |
| 137 | 34 | | get => _shutdownTimeout; |
| 2 | 35 | | set => _shutdownTimeout = value != TimeSpan.Zero ? value : |
| 2 | 36 | | throw new ArgumentException($"0 is not a valid value for {nameof(ShutdownTimeout)}", nameof(value)); |
| | 37 | | } |
| | 38 | |
|
| 133 | 39 | | private TimeSpan _connectTimeout = TimeSpan.FromSeconds(10); |
| 133 | 40 | | private TimeSpan _shutdownTimeout = TimeSpan.FromSeconds(10); |
| | 41 | | } |