예제 #1
0
 internal void AcceptorOnAccept(Acceptor acceptor, Connection connection)
 {
     if (acceptor.Equals(_gatewayAcceptor))
     {
         AcceptGatewayConnection();
         ConnectGatewayConnection(connection);
     }
     else if (acceptor.Equals(_agentAcceptor))
     {
         ConnectAgentConnection(connection);
     }
 }
예제 #2
0
        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 !");
            }
        }
예제 #3
0
        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);
        }