Skip to content

Commit

Permalink
Patch up removal of while loop in Core
Browse files Browse the repository at this point in the history
  • Loading branch information
WiserTixx committed Sep 14, 2024
1 parent deed24f commit a128099
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Network/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -73,6 +73,7 @@ void StartSync(const std::string& Data) {
else
UlStatus = "UlConnection Failed! (WSA failed to start)";
Terminate = true;
CoreSend("L");
return;
}
CheckLocalKey();
Expand Down
12 changes: 10 additions & 2 deletions src/Network/Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}

Expand All @@ -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 "";
}

Expand Down
1 change: 1 addition & 0 deletions src/Network/VehicleEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ void TCPClientMain(const std::string& IP, int Port) {
KillSocket(TCPSock);
WSACleanup();
Terminate = true;
CoreSend("L");
return;
}
info("Connected!");
Expand Down

0 comments on commit a128099

Please sign in to comment.