fix: improve minigame reconnect flow

This commit is contained in:
ud18010
2026-07-29 19:30:50 +08:00
parent 6a5e534d00
commit 42c3874d82
21 changed files with 979 additions and 52 deletions
+7 -2
View File
@@ -14,6 +14,9 @@ namespace XWorld.Server.Gateway.Runner
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "Server.Host.Tests", "TestGames"));
int port = int.TryParse(GetArg(args, "--port"), out int p) ? p : 5005;
int tickMs = int.TryParse(GetArg(args, "--tickMs"), out int t) ? t : 100;
long reconnectWindowTicks = long.TryParse(GetArg(args, "--reconnectWindowTicks"), out long rw)
? rw
: ServerLoop.DefaultReconnectWindowTicks;
long matchTimeoutTicks = long.TryParse(GetArg(args, "--matchTimeoutTicks"), out long mt) ? mt : 150;
string devToken = GetArg(args, "--devToken");
string advertiseWs = GetArg(args, "--advertiseWs");
@@ -49,13 +52,15 @@ namespace XWorld.Server.Gateway.Runner
}
var host = new GameServerHost();
await host.StartAsync(gamesRoot, tickMs, matchTimeoutTicks: matchTimeoutTicks, listenPort: port,
await host.StartAsync(gamesRoot, tickMs, reconnectWindowTicks: reconnectWindowTicks,
matchTimeoutTicks: matchTimeoutTicks, listenPort: port,
bindAllInterfaces: lan,
devDiscoveryToken: devToken, advertiseGatewayUrl: advertiseWs, advertiseResourceBaseUrl: advertiseCdn,
authSecret: authSecret, authDbPath: authDbPath);
Console.WriteLine("XWorld Gateway smoke server started.");
Console.WriteLine(" gamesRoot: " + gamesRoot);
Console.WriteLine(" tickMs: " + tickMs + ", matchTimeoutTicks: " + matchTimeoutTicks);
Console.WriteLine(" tickMs: " + tickMs + ", reconnectWindowTicks: " + reconnectWindowTicks +
", matchTimeoutTicks: " + matchTimeoutTicks);
Console.WriteLine(" ws: " + host.WsBaseUrl + "/ws?pid=1");
if (!string.IsNullOrEmpty(devToken))
Console.WriteLine(" dev-discovery: ON (UDP " + host.DevDiscoveryPort + "), advertise ws=" +