internal void AcceptorOnAccept(Acceptor acceptor, Connection connection) { if (acceptor.Equals(_gatewayAcceptor)) { AcceptGatewayConnection(); ConnectGatewayConnection(connection); } else if (acceptor.Equals(_agentAcceptor)) { ConnectAgentConnection(connection); } }
internal void Setup(IPEndPoint gatewayProxyEndPoint, IPEndPoint agentProxyEndPoint, IPEndPoint gatewayServerEndPoint) { _gatewayServerEndPoint = gatewayServerEndPoint; _agentProxyEndPoint = agentProxyEndPoint; _gatewayAcceptor = new Acceptor(this); if (_gatewayAcceptor.Listen(gatewayProxyEndPoint)) { Console.WriteLine("Gateway Acceptor is listening !"); } //Console.WriteLine("Setup()"); AcceptGatewayConnection(); _agentAcceptor = new Acceptor(this); if (_agentAcceptor.Listen(agentProxyEndPoint)) { Console.WriteLine("Agent Acceptor is listening !"); } }
private void AcceptRemoteConnection(Acceptor acceptor, IPEndPoint endPoint) { int id = Interlocked.Increment(ref _connectionCount); Connection connection = new Connection(acceptor.MyProxy, id, endPoint, ConnectionTypes.ServerType); acceptor.StartAccept(connection); }