Use query port instead of rcon to check alive status

This commit is contained in:
zontreck 2024-06-15 11:57:13 -07:00
parent 62a302c54b
commit e20ade2e95
3 changed files with 12 additions and 2 deletions

View file

@ -113,7 +113,10 @@ class HomePageState extends State<HomePage> {
C2SUploadSettingsPacket upload = C2SUploadSettingsPacket(); C2SUploadSettingsPacket upload = C2SUploadSettingsPacket();
upload.srvSettings = settings.serialize(); upload.srvSettings = settings.serialize();
settings.client!.send(upload, false); await settings.client!.send(upload, false);
Settings.Clear();
setState(() {});
Navigator.pop(context); Navigator.pop(context);
}, },

View file

@ -271,7 +271,7 @@ class StateMachine {
try { try {
Socket sock = await Socket.connect( Socket sock = await Socket.connect(
"127.0.0.1", settings.inst!.serverSettings.RconPort); "127.0.0.1", settings.inst!.serverSettings.QueryPort);
await sock.close(); await sock.close();
} catch (E, stack) { } catch (E, stack) {
print("Dead process checker caught: ${E}\n\n${stack}\n\n"); print("Dead process checker caught: ${E}\n\n${stack}\n\n");

View file

@ -364,4 +364,11 @@ class Settings {
Directory.current = Directory(game_path); Directory.current = Directory(game_path);
} }
static void Clear() {
Instance.inst = SettingsEntry();
Instance.subsys = StateMachine();
Instance.serverLoginCreds = Credentials(username: "admin", password: "");
Instance.server = false;
}
} }