Fix some safety connectivity issues regarding IInstance enumeration

This commit is contained in:
Cyberboss
2017-12-08 11:34:52 -05:00
parent 4e1dbbb215
commit 3ad606c327
3 changed files with 18 additions and 4 deletions
+1 -1
View File
@@ -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; }
+3
View File
@@ -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 -3
View File
@@ -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;
}
}
}