Admins can join full servers

Sessions get cleaned up properly
This commit is contained in:
Westin Miller
2017-12-05 00:42:03 -08:00
parent 18dad5bedf
commit 834395bdc3
4 changed files with 9 additions and 14 deletions

View File

@@ -166,13 +166,13 @@ namespace Torch.Server.Managers
CommitVerdict(info.SteamID, JoinResult.KickedRecently);
else if (info.SteamResponse != JoinResult.OK)
CommitVerdict(info.SteamID, info.SteamResponse);
else if (MyMultiplayer.Static.MemberLimit > 0 &&
MyMultiplayer.Static.MemberCount + 1 > MyMultiplayer.Static.MemberLimit)
CommitVerdict(info.SteamID, JoinResult.ServerFull);
else if (MySandboxGame.ConfigDedicated.GroupID == 0uL ||
MySandboxGame.ConfigDedicated.Administrators.Contains(info.SteamID.ToString()) ||
MySandboxGame.ConfigDedicated.Administrators.Contains(_convertSteamIDFrom64(info.SteamID)))
CommitVerdict(info.SteamID, JoinResult.OK);
else if (MyMultiplayer.Static.MemberLimit > 0 &&
MyMultiplayer.Static.MemberCount + 1 > MyMultiplayer.Static.MemberLimit)
CommitVerdict(info.SteamID, JoinResult.ServerFull);
else if (MySandboxGame.ConfigDedicated.GroupID == info.Group && (info.Member || info.Officer))
CommitVerdict(info.SteamID, JoinResult.OK);
else

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace Torch.Server.Views.Converters

View File

@@ -169,11 +169,9 @@ namespace Torch.Session
if (_currentSession != null)
{
if (_currentSession.State == TorchSessionState.Loaded)
SetState(TorchSessionState.Unloading);
SessionUnloading();
if (_currentSession.State == TorchSessionState.Unloading)
SetState(TorchSessionState.Unloaded);
_currentSession.Detach();
_currentSession = null;
SessionUnloaded();
}
}
}

View File

@@ -378,7 +378,7 @@ namespace Torch
{
Managers.Detach();
Game.SignalDestroy();
if (!Game.WaitFor(VRageGame.GameState.Destroyed, TimeSpan.FromSeconds(15)))
if (!Game.WaitFor(VRageGame.GameState.Destroyed, _gameStateChangeTimeout))
Log.Warn("Failed to wait for the game to be destroyed");
Game = null;
}
@@ -428,7 +428,7 @@ namespace Torch
public virtual void Start()
{
Game.SignalStart();
if (!Game.WaitFor(VRageGame.GameState.Running, TimeSpan.FromSeconds(15)))
if (!Game.WaitFor(VRageGame.GameState.Running, _gameStateChangeTimeout))
Log.Warn("Failed to wait for the game to be started");
}
@@ -437,7 +437,7 @@ namespace Torch
{
LogManager.Flush();
Game.SignalStop();
if (!Game.WaitFor(VRageGame.GameState.Stopped, TimeSpan.FromSeconds(15)))
if (!Game.WaitFor(VRageGame.GameState.Stopped, _gameStateChangeTimeout))
Log.Warn("Failed to wait for the game to be stopped");
}
@@ -491,6 +491,7 @@ namespace Torch
}
private static readonly HashSet<Assembly> _registeredAuxAssemblies = new HashSet<Assembly>();
private static readonly TimeSpan _gameStateChangeTimeout = TimeSpan.FromMinutes(1);
/// <summary>
/// Registers an auxillary (plugin) assembly with the system, including its