Example #1
0
        private void InitConnectionAsClient(PeerAddress peerAddress)
        {
            List <SuperPeerServer> onlineServers = new List <SuperPeerServer>(ConnectionsRepository.GetServers());
            SuperPeerServer        targetServer  = null;

            foreach (SuperPeerServer server in onlineServers)
            {
                if (server.GetClientInfo().PeerAddress().Equals(peerAddress))
                {
                    targetServer = server;
                }
            }

            if (targetServer == null)
            {
                return;
            }

            if (!targetServer.AllowedConnection.Equals(_superPeerClient.GetClientInfo().PeerAddress()))
            {
                return;
            }

            ConnectionPair connectionPair = CreateConnectionPair(targetServer, _superPeerClient);

            ProcessConnectionBetweenClients(connectionPair);
        }
 public static void AddServer(SuperPeerServer server)
 {
     lock (_peersMonitor)
     {
         _servers.Add(server);
     }
 }       
 public static void RemoveServer(SuperPeerServer server)
 {
     lock (_peersMonitor)
     {
         _servers.Remove(server);
     }
 }
Example #4
0
 public static void AddServer(SuperPeerServer server)
 {
     lock (_peersMonitor)
     {
         _servers.Add(server);
     }
 }
Example #5
0
 public static void RemoveServer(SuperPeerServer server)
 {
     lock (_peersMonitor)
     {
         _servers.Remove(server);
     }
 }
        private SuperPeerNode GetSuperPeerNodeByClientType(ClientType clientType)
        {
            SuperPeerNode superPeerNode;

            if (clientType == ClientType.Client)            
                superPeerNode = new SuperPeerClient(_superPeer, _client);            
            else
                superPeerNode = new SuperPeerServer(_superPeer, _client);

            return superPeerNode;
        }
Example #7
0
        private ConnectionPair CreateConnectionPair(SuperPeerServer server, SuperPeerClient client)
        {
            ConnectionPair connectionPair = new ConnectionPair(server, client);

            if (!ConnectionsRepository.GetConnections().Contains(connectionPair))
            {
                ConnectionsRepository.AddConnection(connectionPair);
                return(connectionPair);
            }

            return(null);
        }
        private ConnectionPair CreateConnectionPair(SuperPeerServer server, SuperPeerClient client)
        {
            ConnectionPair connectionPair = new ConnectionPair(server, client);

            if (!ConnectionsRepository.GetConnections().Contains(connectionPair))
            {
                ConnectionsRepository.AddConnection(connectionPair);
                return connectionPair;
            }

            return null;
        }
Example #9
0
        private SuperPeerNode GetSuperPeerNodeByClientType(ClientType clientType)
        {
            SuperPeerNode superPeerNode;

            if (clientType == ClientType.Client)
            {
                superPeerNode = new SuperPeerClient(_superPeer, _client);
            }
            else
            {
                superPeerNode = new SuperPeerServer(_superPeer, _client);
            }

            return(superPeerNode);
        }
 public ServerMessageManager(SuperPeerServer superPeerServer)
 {
     _superPeerServer = superPeerServer;
 }
 public Connection(SuperPeerServer server, SuperPeerClient client)
 {
     Server = server;
     Client = client;
 }
 public Connection(SuperPeerServer server, SuperPeerClient client)
 {
     Server = server;
     Client = client;
 }
Example #13
0
 public ServerMessageManager(SuperPeerServer superPeerServer)
 {
     _superPeerServer = superPeerServer;
 }
Example #14
0
 public TcpConnection(SuperPeerServer server, SuperPeerClient client)
     : base(server, client)
 {            
 }
Example #15
0
 public TcpConnection(SuperPeerServer server, SuperPeerClient client)
     : base(server, client)
 {
 }