From bdc64dbd6f31a486b8aa498cfc09c78c0109debc Mon Sep 17 00:00:00 2001 From: Micah Date: Thu, 13 May 2021 12:14:16 -0500 Subject: [PATCH] Only use second line of `server.pid` for port info No need for a `while` loop! Addresses https://github.com/learningequality/kolibri-installer-windows/issues/187 --- src/gui-source/Kolibri/Kolibri.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui-source/Kolibri/Kolibri.cpp b/src/gui-source/Kolibri/Kolibri.cpp index 10006cd..74307c1 100755 --- a/src/gui-source/Kolibri/Kolibri.cpp +++ b/src/gui-source/Kolibri/Kolibri.cpp @@ -73,10 +73,10 @@ char * getKolibriLinkAddress() { std::ifstream file(pidFile); if (file.is_open()) { std::string line; - while (getline(file, line)) { - if (isServerOnline("Kolibri session", joinChr("http://127.0.0.1:", line.c_str()))) { - httpLink = joinChr("http://127.0.0.1:", line.c_str()); - } + getline(file, line); // get the first line, do nothing + getline(file, line); // the second line should have the the port information + if (isServerOnline("Kolibri session", joinChr("http://127.0.0.1:", line.c_str()))) { + httpLink = joinChr("http://127.0.0.1:", line.c_str()); } file.close(); return httpLink;