示例#1
0
文件: AgonesSDK.cs 项目: yuryu/agones
 /// <summary>
 /// This returns most of the backing GameServer configuration and Status.
 /// This can be useful for instances where you may want to know Health check configuration, or the IP and Port the GameServer is currently allocated to.
 /// </summary>
 /// <returns>A GameServer object containing this GameServer's configuration data</returns>
 public async Task <GameServer> GetGameServerAsync()
 {
     try
     {
         return(await client.GetGameServerAsync(new Empty(), deadline : DateTime.UtcNow.AddSeconds(RequestTimeout), cancellationToken : ctoken));
     }
     catch (RpcException ex)
     {
         Console.Error.WriteLine(ex.Message);
         //Should I rethrow the exception?
         return(null);
     }
 }
示例#2
0
 /// <summary>
 /// This returns most of the backing GameServer configuration and Status.
 /// This can be useful for instances where you may want to know Health check configuration, or the IP and Port the GameServer is currently allocated to.
 /// </summary>
 /// <returns>A GameServer object containing this GameServer's configuration data</returns>
 public async Task <GameServer> GetGameServerAsync()
 {
     try
     {
         return(await client.GetGameServerAsync(new Empty(),
                                                deadline : DateTime.UtcNow.AddSeconds(RequestTimeoutSec),
                                                cancellationToken : ctoken));
     }
     catch (RpcException ex)
     {
         LogError(ex, "Unable to get GameServer configuration and status.");
         throw;
     }
 }