Admins can join full servers
Sessions get cleaned up properly
This commit is contained in:
@@ -166,13 +166,13 @@ namespace Torch.Server.Managers
|
|||||||
CommitVerdict(info.SteamID, JoinResult.KickedRecently);
|
CommitVerdict(info.SteamID, JoinResult.KickedRecently);
|
||||||
else if (info.SteamResponse != JoinResult.OK)
|
else if (info.SteamResponse != JoinResult.OK)
|
||||||
CommitVerdict(info.SteamID, info.SteamResponse);
|
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 ||
|
else if (MySandboxGame.ConfigDedicated.GroupID == 0uL ||
|
||||||
MySandboxGame.ConfigDedicated.Administrators.Contains(info.SteamID.ToString()) ||
|
MySandboxGame.ConfigDedicated.Administrators.Contains(info.SteamID.ToString()) ||
|
||||||
MySandboxGame.ConfigDedicated.Administrators.Contains(_convertSteamIDFrom64(info.SteamID)))
|
MySandboxGame.ConfigDedicated.Administrators.Contains(_convertSteamIDFrom64(info.SteamID)))
|
||||||
CommitVerdict(info.SteamID, JoinResult.OK);
|
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))
|
else if (MySandboxGame.ConfigDedicated.GroupID == info.Group && (info.Member || info.Officer))
|
||||||
CommitVerdict(info.SteamID, JoinResult.OK);
|
CommitVerdict(info.SteamID, JoinResult.OK);
|
||||||
else
|
else
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Torch.Server.Views.Converters
|
namespace Torch.Server.Views.Converters
|
||||||
|
@@ -169,11 +169,9 @@ namespace Torch.Session
|
|||||||
if (_currentSession != null)
|
if (_currentSession != null)
|
||||||
{
|
{
|
||||||
if (_currentSession.State == TorchSessionState.Loaded)
|
if (_currentSession.State == TorchSessionState.Loaded)
|
||||||
SetState(TorchSessionState.Unloading);
|
SessionUnloading();
|
||||||
if (_currentSession.State == TorchSessionState.Unloading)
|
if (_currentSession.State == TorchSessionState.Unloading)
|
||||||
SetState(TorchSessionState.Unloaded);
|
SessionUnloaded();
|
||||||
_currentSession.Detach();
|
|
||||||
_currentSession = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -378,7 +378,7 @@ namespace Torch
|
|||||||
{
|
{
|
||||||
Managers.Detach();
|
Managers.Detach();
|
||||||
Game.SignalDestroy();
|
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");
|
Log.Warn("Failed to wait for the game to be destroyed");
|
||||||
Game = null;
|
Game = null;
|
||||||
}
|
}
|
||||||
@@ -428,7 +428,7 @@ namespace Torch
|
|||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
{
|
{
|
||||||
Game.SignalStart();
|
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");
|
Log.Warn("Failed to wait for the game to be started");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ namespace Torch
|
|||||||
{
|
{
|
||||||
LogManager.Flush();
|
LogManager.Flush();
|
||||||
Game.SignalStop();
|
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");
|
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 HashSet<Assembly> _registeredAuxAssemblies = new HashSet<Assembly>();
|
||||||
|
private static readonly TimeSpan _gameStateChangeTimeout = TimeSpan.FromMinutes(1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers an auxillary (plugin) assembly with the system, including its
|
/// Registers an auxillary (plugin) assembly with the system, including its
|
||||||
|
Reference in New Issue
Block a user