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

View File

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

View File

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