Example #1
0
 private void RemoveClosedConnections()
 {
     foreach (var connection in _removedClientConnections)
     {
         connection.Dispose();
         GameClientConnections.Remove(connection);
     }
     _removedClientConnections.Clear();
     if (_managementServerConnection != null && _managementServerConnection.IsDisposed)
         _managementServerConnection = null;
     if (GameServerConnection != null && GameServerConnection.IsDisposed)
         GameServerConnection = null;
     if (Game.DataEngine.Arena != null)
     {
         foreach (var conn in GameClientConnections)
             if (conn.IsDisposed)
                 foreach (var gob in Game.DataEngine.Arena.GobsInRelevantLayers)
                     gob.ClientStatus[1 << conn.ID] = false;
     }
     GameClientConnections.RemoveAll(c => c.IsDisposed);
 }
Example #2
0
 /// <summary>
 /// Does nothing if a connection to the management server already exists.
 /// Otherwise, finds a management server and initialises <see cref="ManagementServerConnection"/>.
 /// May use DNS and take some time to finish. May throw <see cref="ArgumentException"/>.
 /// </summary>
 public void EnsureConnectionToManagementServer()
 {
     if (_managementServerConnection != null) return;
     var managementServerEndPoint = MiscHelper.ParseIPEndPoint(Game.Settings.Net.ManagementServerAddress);
     if (managementServerEndPoint.Port == 0)
         managementServerEndPoint.Port = MANAGEMENT_SERVER_PORT_DEFAULT;
     _managementServerConnection = new ManagementServerConnection(_game, managementServerEndPoint);
 }