| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using IceRpc.Transports.Slic.Internal; |
| | | 4 | | using System.Net.Security; |
| | | 5 | | |
| | | 6 | | namespace IceRpc.Transports.Slic; |
| | | 7 | | |
| | | 8 | | /// <summary>Implements <see cref="IMultiplexedClientTransport" /> using Slic over a duplex client transport.</summary> |
| | | 9 | | public class SlicClientTransport : IMultiplexedClientTransport |
| | | 10 | | { |
| | | 11 | | /// <inheritdoc/> |
| | 50 | 12 | | public string Name => _duplexClientTransport.Name; |
| | | 13 | | |
| | | 14 | | private readonly IDuplexClientTransport _duplexClientTransport; |
| | | 15 | | private readonly SlicTransportOptions _slicTransportOptions; |
| | | 16 | | |
| | | 17 | | /// <summary>Constructs a Slic client transport.</summary> |
| | | 18 | | /// <param name="options">The options to configure the Slic transport.</param> |
| | | 19 | | /// <param name="duplexClientTransport">The duplex client transport.</param> |
| | 686 | 20 | | public SlicClientTransport(SlicTransportOptions options, IDuplexClientTransport duplexClientTransport) |
| | 686 | 21 | | { |
| | 686 | 22 | | _duplexClientTransport = duplexClientTransport; |
| | 686 | 23 | | _slicTransportOptions = options; |
| | 686 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary>Constructs a Slic client transport.</summary> |
| | | 27 | | /// <param name="duplexClientTransport">The duplex client transport.</param> |
| | | 28 | | public SlicClientTransport(IDuplexClientTransport duplexClientTransport) |
| | 67 | 29 | | : this(new SlicTransportOptions(), duplexClientTransport) |
| | 67 | 30 | | { |
| | 67 | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <inheritdoc/> |
| | | 34 | | public IMultiplexedConnection CreateConnection( |
| | | 35 | | ServerAddress serverAddress, |
| | | 36 | | MultiplexedConnectionOptions options, |
| | | 37 | | SslClientAuthenticationOptions? clientAuthenticationOptions) => |
| | 697 | 38 | | new SlicConnection( |
| | 697 | 39 | | _duplexClientTransport.CreateConnection( |
| | 697 | 40 | | serverAddress, |
| | 697 | 41 | | new DuplexConnectionOptions |
| | 697 | 42 | | { |
| | 697 | 43 | | MinSegmentSize = options.MinSegmentSize, |
| | 697 | 44 | | Pool = options.Pool |
| | 697 | 45 | | }, |
| | 697 | 46 | | clientAuthenticationOptions), |
| | 697 | 47 | | options, |
| | 697 | 48 | | _slicTransportOptions, |
| | 697 | 49 | | isServer: false); |
| | | 50 | | } |