Fix process not cleanly exiting when it was supposed to

This commit is contained in:
zontreck 2024-06-05 20:28:19 -07:00
parent 26434a9123
commit 6574888344
4 changed files with 32 additions and 7 deletions

View file

@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:libac_dart/nbt/NbtUtils.dart';
import 'package:libac_dart/nbt/Stream.dart';
@ -303,6 +304,7 @@ class C2SUploadSettingsPacket implements IPacket {
// Stop packet server
PacketServer.socket!.close();
timer.cancel();
exit(0);
}); // We give time to allow the server to shut down gracefully.
}

View file

@ -21,6 +21,26 @@ class ModManagerState extends State<ModManager> {
appBar: AppBar(
title: Text("Conan Exiles Server Manager - Mod Manager"),
backgroundColor: Color.fromARGB(255, 100, 0, 0),
actions: [
IconButton(
onPressed: () {
for (Mod M in settings.inst!.mods) {
M.enabled = false;
}
setState(() {});
},
icon: Icon(Icons.swipe_down)),
IconButton(
onPressed: () {
for (Mod M in settings.inst!.mods) {
M.enabled = true;
}
setState(() {});
},
icon: Icon(Icons.swipe_up))
],
),
body: ReorderableListView.builder(
onReorder: (oldIndex, newIndex) {

View file

@ -224,6 +224,7 @@ class StateMachine {
if (settings.inst!.pterodactylMode) {
// Shut down the server processes now
PacketServer.socket!.close();
exit(0);
} else {
resetKillswitch();
SessionData.timer = settings.inst!.timer.time.copy();
@ -297,12 +298,14 @@ class StateMachine {
}
}
settings.sendRconCommand(
"broadcast The server will be going down for a restart in 5 minutes. The following mods have been updated: ${updatedMods.join(', ')}");
SessionData.timer.apply((5 * 60));
print(
"Scheduling restart for mod updates: ${updatedMods.join(', ')}");
SessionData.enableRestartTimer = true;
if (updatedMods.isNotEmpty) {
settings.sendRconCommand(
"broadcast The server will be going down for a restart in 5 minutes. The following mods have been updated: ${updatedMods.join(', ')}");
SessionData.timer.apply((5 * 60));
print(
"Scheduling restart for mod updates: ${updatedMods.join(', ')}");
SessionData.enableRestartTimer = true;
}
});
}

View file

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 1.1.0+1
environment:
sdk: '>=3.1.4 <4.0.0'