Patch up removal of while loop in Core

This commit is contained in:
Tixx 2024-08-15 23:36:00 +02:00
parent deed24f6e8
commit a128099619
3 changed files with 13 additions and 3 deletions

View File

@ -51,7 +51,7 @@ bool SecurityWarning() {
confirmed = -1; confirmed = -1;
CoreSend("WMODS_FOUND"); CoreSend("WMODS_FOUND");
while (confirmed == -1) while (confirmed == -1 || Terminate == false)
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
if (confirmed == 1) if (confirmed == 1)
@ -73,6 +73,7 @@ void StartSync(const std::string& Data) {
else else
UlStatus = "UlConnection Failed! (WSA failed to start)"; UlStatus = "UlConnection Failed! (WSA failed to start)";
Terminate = true; Terminate = true;
CoreSend("L");
return; return;
} }
CheckLocalKey(); CheckLocalKey();

View File

@ -63,16 +63,20 @@ std::string Auth(SOCKET Sock) {
if (Res.empty() || Res[0] == 'E' || Res[0] == 'K') { if (Res.empty() || Res[0] == 'E' || Res[0] == 'K') {
Abord(); Abord();
CoreSend("L");
return ""; return "";
} }
TCPSend(PublicKey, Sock); TCPSend(PublicKey, Sock);
if (Terminate) if (Terminate) {
CoreSend("L");
return ""; return "";
}
Res = TCPRcv(Sock); Res = TCPRcv(Sock);
if (Res.empty() || Res[0] != 'P') { if (Res.empty() || Res[0] != 'P') {
Abord(); Abord();
CoreSend("L");
return ""; return "";
} }
@ -81,17 +85,21 @@ std::string Auth(SOCKET Sock) {
ClientID = std::stoi(Res); ClientID = std::stoi(Res);
} else { } else {
Abord(); Abord();
CoreSend("L");
UUl("Authentication failed!"); UUl("Authentication failed!");
return ""; return "";
} }
TCPSend("SR", Sock); TCPSend("SR", Sock);
if (Terminate) if (Terminate) {
CoreSend("L");
return ""; return "";
}
Res = TCPRcv(Sock); Res = TCPRcv(Sock);
if (Res[0] == 'E' || Res[0] == 'K') { if (Res[0] == 'E' || Res[0] == 'K') {
Abord(); Abord();
CoreSend("L");
return ""; return "";
} }

View File

@ -152,6 +152,7 @@ void TCPClientMain(const std::string& IP, int Port) {
KillSocket(TCPSock); KillSocket(TCPSock);
WSACleanup(); WSACleanup();
Terminate = true; Terminate = true;
CoreSend("L");
return; return;
} }
info("Connected!"); info("Connected!");