Update Endpoint.cs
This commit is contained in:
parent
8a47b75c18
commit
b181c29386
1 changed files with 7 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
using Grapevine;
|
using Grapevine;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
@ -83,8 +83,12 @@ namespace LightReflectiveMirror.LoadBalancing
|
||||||
if (lowest.Key.Address != "Dummy")
|
if (lowest.Key.Address != "Dummy")
|
||||||
{
|
{
|
||||||
// ping server to ensure its online.
|
// ping server to ensure its online.
|
||||||
await Program.instance.ManualPingServer(lowest.Key.Address, lowest.Key.Port);
|
var chosenServer = await Program.instance.ManualPingServer(lowest.Key.Address, lowest.Key.EndpointPort);
|
||||||
|
|
||||||
|
if(chosenServer.HasValue)
|
||||||
await context.Response.SendResponseAsync(JsonConvert.SerializeObject(lowest.Key));
|
await context.Response.SendResponseAsync(JsonConvert.SerializeObject(lowest.Key));
|
||||||
|
else
|
||||||
|
await context.Response.SendResponseAsync(HttpStatusCode.BadGateway);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue