Fixes a bug causing the software to be stuck in the Stopping Servers state

Fixes the case where the software tries to stop servers while no servers are actually running.
This also fixes #10
This commit is contained in:
Kristian Knarvik 2021-08-21 13:53:41 +02:00
parent 44d8d6ee6b
commit 133e335905

View File

@ -60,10 +60,13 @@ public class ServerHandler {
} }
stoppingServers = true; stoppingServers = true;
int serversRunning = 0;
for (Collection collection : Main.getController().getCurrentProfile().getCollections()) { for (Collection collection : Main.getController().getCurrentProfile().getCollections()) {
Server server = collection.getServer(); Server server = collection.getServer();
BufferedWriter writer = server.getWriter(); BufferedWriter writer = server.getWriter();
if (writer != null) { if (writer != null) {
serversRunning++;
if (server.isProxy()) { if (server.isProxy()) {
writer.write("end\n"); writer.write("end\n");
} else { } else {
@ -74,7 +77,10 @@ public class ServerHandler {
server.setStopped(); server.setStopped();
} }
} }
//TODO: Set stoppingServers to false if no servers are actually running
if (serversRunning == 0) {
stoppingServers = false;
}
} }
/** /**