Ejemplo n.º 1
0
        /// <summary>
        ///     Connects to superpeers that are required for the new zone.
        /// </summary>
        /// <param name="zone">Zone that player is moving to.</param>
        private void ConnectToNewSuperPeers(Zone zone)
        {
            foreach (ZoneSuperPeer peer in zone.SuperPeers)
            {
                bool connected = false;

                // Are we connected to the peer hosting this super peer?
                foreach (ClientToSuperPeerConnection c in m_superPeerConnections)
                {
                    if (c.ClientID == peer.ClientID)
                    {
                        connected = true;
                        break;
                    }
                }

                if (connected == false)
                {
                    Logger.Info("Connecting to peer hosting SuperPeer #{0} for zone #{1} on {2}:{3}.", LoggerVerboseLevel.High, peer.ID, peer.ZoneID, peer.ClientIPAddress, peer.ClientListenPort);

                    // Connect to super peer!
                    Connection connection = new Connection();
                    connection.ConnectOverTime(peer.ClientIPAddress, (ushort)peer.ClientListenPort);

                    m_superPeerConnections.Add(new ClientToSuperPeerConnection(this, connection, peer.ClientID));
                }
            }
        }