mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 22:48:20 +01:00
Fix some safety connectivity issues regarding IInstance enumeration
This commit is contained in:
@@ -15,7 +15,7 @@ namespace TGS.Interface.Wrappers
|
||||
new Version Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="IInstance"/>s the <see cref="IServer"/> contains that the current user can access
|
||||
/// Get the <see cref="IInstance"/>s the <see cref="IServer"/> contains that the current user can access and connect to
|
||||
/// </summary>
|
||||
IEnumerable<IInstance> Instances { get; }
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ namespace TGS.Interface.Wrappers
|
||||
{
|
||||
serverInterface = _serverInterface;
|
||||
metadata = _metadata;
|
||||
if (metadata.Enabled)
|
||||
//run a connectivity check
|
||||
serverInterface.GetComponent<ITGConnectivity>(metadata.Name).VerifyConnection();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -14,10 +14,21 @@ namespace TGS.Interface.Wrappers
|
||||
public IEnumerable<IInstance> Instances { get
|
||||
{
|
||||
lock (this)
|
||||
if(knownInstances == null)
|
||||
if (knownInstances == null)
|
||||
knownInstances = serverInterface.GetComponent<ITGLanding>(null).ListInstances();
|
||||
foreach(var I in knownInstances)
|
||||
yield return new Instance(serverInterface, I);
|
||||
foreach (var I in knownInstances)
|
||||
{
|
||||
IInstance nextInstance;
|
||||
try
|
||||
{
|
||||
nextInstance = new Instance(serverInterface, I);
|
||||
}
|
||||
catch
|
||||
{
|
||||
continue;
|
||||
}
|
||||
yield return nextInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user