Skip to content

Commit

Permalink
fix: Fix crashes on Steam close
Browse files Browse the repository at this point in the history
  • Loading branch information
shdwmtr committed Aug 26, 2024
1 parent cdff8ba commit 4d09aa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ int __stdcall DllMain(void*, unsigned long fdwReason, void*)
case DLL_PROCESS_DETACH:
{
Logger.PrintMessage(" MAIN ", "Shutting down Millennium...", COL_MAGENTA);
std::exit(EXIT_SUCCESS);
g_threadTerminateFlag->flag.store(true);
Sockets::Shutdown();
g_millenniumThread->join();
Logger.PrintMessage(" MAIN ", "Millennium has been shut down.", COL_MAGENTA);
//std::this_thread::sleep_for(std::chrono::milliseconds(100000000));
break;
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/socket/await_pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#endif
#include <procmon/cmd.h>

static bool bHasCheckedConnection = false;

class SocketHelpers
{
private:
Expand Down Expand Up @@ -183,8 +185,12 @@ class SocketHelpers
const void VerifySteamConnection()
{
#ifndef MILLENNIUM_CLI
auto [canConnect, processName] = this->GetSteamConnectionProps();
if (bHasCheckedConnection)
{
return;
}

auto [canConnect, processName] = this->GetSteamConnectionProps();
if (!canConnect)
{
const std::string message = fmt::format(
Expand All @@ -199,6 +205,8 @@ class SocketHelpers
Logger.Warn(message);
std::exit(1);
}

bHasCheckedConnection = true;
#endif
}

Expand Down

0 comments on commit 4d09aa6

Please sign in to comment.