| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using IceRpc.Transports.Coloc.Internal; |
| | | 4 | | using System.Collections.Concurrent; |
| | | 5 | | |
| | | 6 | | namespace IceRpc.Transports.Coloc; |
| | | 7 | | |
| | | 8 | | /// <summary>The Coloc transport class provides a client and server duplex transport that can be used for in-process |
| | | 9 | | /// communications.</summary> |
| | | 10 | | public sealed class ColocTransport |
| | | 11 | | { |
| | | 12 | | /// <summary>The transport name.</summary> |
| | | 13 | | public const string Name = "coloc"; |
| | | 14 | | |
| | | 15 | | /// <summary>Gets the colocated client transport.</summary> |
| | | 16 | | /// <value>The client transport.</value> |
| | 1005 | 17 | | public IDuplexClientTransport ClientTransport { get; } |
| | | 18 | | |
| | | 19 | | /// <summary>Gets the colocated server transport.</summary> |
| | | 20 | | /// <value>The server transport.</value> |
| | 1014 | 21 | | public IDuplexServerTransport ServerTransport { get; } |
| | | 22 | | |
| | | 23 | | /// <summary>Constructs a <see cref="ColocTransport" />.</summary> |
| | | 24 | | public ColocTransport() |
| | 68 | 25 | | : this(new ColocTransportOptions()) |
| | 68 | 26 | | { |
| | 68 | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary>Constructs a <see cref="ColocTransport" />.</summary> |
| | | 30 | | /// <param name="options">The options to configure the Coloc transport.</param> |
| | 978 | 31 | | public ColocTransport(ColocTransportOptions options) |
| | 978 | 32 | | { |
| | 978 | 33 | | var listeners = new ConcurrentDictionary<ServerAddress, ColocListener>(); |
| | 978 | 34 | | ClientTransport = new ColocClientTransport(listeners, options); |
| | 978 | 35 | | ServerTransport = new ColocServerTransport(listeners, options); |
| | 978 | 36 | | } |
| | | 37 | | |
| | 2001 | 38 | | internal static bool CheckParams(ServerAddress serverAddress) => serverAddress.Params.Count == 0; |
| | | 39 | | } |