From e20ade2e95d6edcd68484a5b9e80e0e790e9f076 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 15 Jun 2024 11:57:13 -0700 Subject: [PATCH] Use query port instead of rcon to check alive status --- lib/pages/home.dart | 5 ++++- lib/statemachine.dart | 2 +- lib/structs/settings.dart | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 40a8fec..f400616 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -113,7 +113,10 @@ class HomePageState extends State { C2SUploadSettingsPacket upload = C2SUploadSettingsPacket(); upload.srvSettings = settings.serialize(); - settings.client!.send(upload, false); + await settings.client!.send(upload, false); + Settings.Clear(); + + setState(() {}); Navigator.pop(context); }, diff --git a/lib/statemachine.dart b/lib/statemachine.dart index a07fab2..83a4d55 100644 --- a/lib/statemachine.dart +++ b/lib/statemachine.dart @@ -271,7 +271,7 @@ class StateMachine { try { Socket sock = await Socket.connect( - "127.0.0.1", settings.inst!.serverSettings.RconPort); + "127.0.0.1", settings.inst!.serverSettings.QueryPort); await sock.close(); } catch (E, stack) { print("Dead process checker caught: ${E}\n\n${stack}\n\n"); diff --git a/lib/structs/settings.dart b/lib/structs/settings.dart index e270003..8c6d8c4 100644 --- a/lib/structs/settings.dart +++ b/lib/structs/settings.dart @@ -364,4 +364,11 @@ class Settings { Directory.current = Directory(game_path); } + + static void Clear() { + Instance.inst = SettingsEntry(); + Instance.subsys = StateMachine(); + Instance.serverLoginCreds = Credentials(username: "admin", password: ""); + Instance.server = false; + } }