public PeerDisconnected(PeerConnectionDirection direction, Guid peerId, IPEndPoint remoteEndPoint, string reason, Exception exception) : base(remoteEndPoint) { this.Direction = direction; this.PeerId = peerId; this.Reason = reason; this.Exception = exception; }
public PeerConnection(ILogger <PeerConnection> logger, IEventBus eventBus, TcpClient connectedClient, PeerConnectionDirection peerConnectionDirection, IPeerContextFactory peerContextFactory, NetworkMessageDecoder networkMessageDecoder, INetworkMessageProcessorFactory networkMessageProcessorFactory, CancellationToken cancellationToken) { this.logger = logger; this.eventBus = eventBus; this.ConnectedClient = connectedClient; this.Direction = peerConnectionDirection; this.peerContextFactory = peerContextFactory; this.networkMessageDecoder = networkMessageDecoder; this.networkMessageProcessorFactory = networkMessageProcessorFactory; this.cancellationToken = cancellationToken; this.PeerContext = this.peerContextFactory.Create( PeerConnectionDirection.Inbound, Guid.NewGuid().ToString(), connectedClient.Client.LocalEndPoint, connectedClient.Client.RemoteEndPoint, this); this.networkMessageDecoder.SetPeerContext(this.PeerContext); this.connectionStateMachine = new PeerConnectionStateMachine(logger, eventBus, this, networkMessageDecoder, networkMessageProcessorFactory, cancellationToken); }
public NetworkPeerContext(ILogger logger, IEventBus eventBus, PeerConnectionDirection direction, string peerId, EndPoint localEndPoint, EndPoint publicEndPoint, EndPoint remoteEndPoint, INetworkMessageWriter messageWriter) : base(logger, eventBus, direction, peerId, localEndPoint, publicEndPoint, remoteEndPoint, messageWriter) { }
public PeerContext(ILogger logger, IEventBus eventBus, PeerConnectionDirection direction, string peerId, EndPoint localEndPoint, EndPoint publicEndPoint, EndPoint remoteEndPoint, INetworkMessageWriter messageWriter) { this.logger = logger; this.eventBus = eventBus; Direction = direction; PeerId = peerId; this.messageWriter = messageWriter; LocalEndPoint = localEndPoint.AsIPEndPoint(); PublicEndPoint = publicEndPoint.AsIPEndPoint(); RemoteEndPoint = remoteEndPoint.AsIPEndPoint(); }
public PeerConnection(ILogger <PeerConnection> logger, IEventBus eventBus, IDateTimeProvider dateTimeProvider, TcpClient connectedClient, PeerConnectionDirection peerConnectionDirection, CancellationToken cancellationToken) { this.logger = logger; this.eventBus = eventBus; this.dateTimeProvider = dateTimeProvider; this.ConnectedClient = connectedClient; this.Direction = peerConnectionDirection; this.cancellationToken = cancellationToken; this.PeerConnectionId = Guid.NewGuid(); this.connectionStateMachine = new PeerConnectionStateMachine(logger, eventBus, this, cancellationToken); }
protected virtual IPeerContext Create(PeerConnectionDirection direction, string peerId, EndPoint localEndPoint, EndPoint remoteEndPoint, INetworkMessageWriter messageWriter) { var peerContext = (TPeerContext)System.Activator.CreateInstance(typeof(TPeerContext), _loggerFactory.CreateLogger <IPeerContext>(), _eventBus, direction, peerId, localEndPoint, GetPublicEndPoint(localEndPoint), remoteEndPoint, messageWriter ) !; return(peerContext); }