feat: wait for server to be accessible on open

This commit is contained in:
CyberL1 2024-07-06 09:06:00 +02:00
parent 7bc0169dda
commit 640cc80758

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR.Protocol;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Minecraft_Realms_Emulator.Attributes; using Minecraft_Realms_Emulator.Attributes;
using Minecraft_Realms_Emulator.Data; using Minecraft_Realms_Emulator.Data;
@ -676,6 +677,20 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
_context.SaveChanges(); _context.SaveChanges();
var connection = _context.Connections.FirstOrDefault(c => c.World.Id == wId);
var query = new MinecraftServerQuery().Query(connection.Address);
while (query == null)
{
var newQuery = new MinecraftServerQuery().Query(connection.Address);
if (newQuery != null)
{
break;
}
}
return Ok(true); return Ok(true);
} }