/// <summary> /// Connect to the given <see cref="SimpleTransport"/>. /// </summary> /// <param name="otherTransport">Transport to connect with</param> public void Connect(SimpleTransport otherTransport) { if (otherTransport == null) { throw new ArgumentNullException(nameof(otherTransport)); } var thisConnection = this.CreateConnection(); var otherConnection = otherTransport.CreateConnection(); thisConnection.ConnectTo(otherConnection); otherConnection.ConnectTo(thisConnection); this.OnNewConnection?.Invoke(thisConnection); otherTransport.OnNewConnection?.Invoke(otherConnection); thisConnection.Start(); otherConnection.Start(); Trace.TraceInformation($"SimpleTransport.Connect transportId={this.Id}, otherTransportId={otherTransport.Id}"); }
public Connection(ulong id, SimpleTransport transport) { this.Id = id; this.transport = transport; this.cancellationSource = new CancellationTokenSource(); }