| | | 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="IMultiplexedServerTransport" /> using Slic over a duplex server transport.</summary> |
| | | 9 | | public class SlicServerTransport : IMultiplexedServerTransport |
| | | 10 | | { |
| | | 11 | | /// <inheritdoc/> |
| | 97 | 12 | | public string Name => _duplexServerTransport.Name; |
| | | 13 | | |
| | | 14 | | private readonly IDuplexServerTransport _duplexServerTransport; |
| | | 15 | | private readonly SlicTransportOptions _slicTransportOptions; |
| | | 16 | | |
| | | 17 | | /// <summary>Constructs a Slic server transport.</summary> |
| | | 18 | | /// <param name="options">The options to configure the transport.</param> |
| | | 19 | | /// <param name="duplexServerTransport">The duplex server transport.</param> |
| | 734 | 20 | | public SlicServerTransport(SlicTransportOptions options, IDuplexServerTransport duplexServerTransport) |
| | 734 | 21 | | { |
| | 734 | 22 | | _slicTransportOptions = options; |
| | 734 | 23 | | _duplexServerTransport = duplexServerTransport; |
| | 734 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary>Constructs a Slic server transport.</summary> |
| | | 27 | | /// <param name="duplexServerTransport">The duplex server transport.</param> |
| | | 28 | | public SlicServerTransport(IDuplexServerTransport duplexServerTransport) |
| | 74 | 29 | | : this(new SlicTransportOptions(), duplexServerTransport) |
| | 74 | 30 | | { |
| | 74 | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <inheritdoc/> |
| | | 34 | | public IListener<IMultiplexedConnection> Listen( |
| | | 35 | | ServerAddress serverAddress, |
| | | 36 | | MultiplexedConnectionOptions options, |
| | | 37 | | SslServerAuthenticationOptions? serverAuthenticationOptions) => |
| | 723 | 38 | | new SlicListener( |
| | 723 | 39 | | _duplexServerTransport.Listen( |
| | 723 | 40 | | serverAddress, |
| | 723 | 41 | | new DuplexConnectionOptions |
| | 723 | 42 | | { |
| | 723 | 43 | | MinSegmentSize = options.MinSegmentSize, |
| | 723 | 44 | | Pool = options.Pool |
| | 723 | 45 | | }, |
| | 723 | 46 | | serverAuthenticationOptions), |
| | 723 | 47 | | options, |
| | 723 | 48 | | _slicTransportOptions); |
| | | 49 | | } |