Skip to content

Commit

Permalink
Fix CC connection bugs (#2367)
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus authored Jan 18, 2023
1 parent 750ae90 commit a5f7478
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions soh/soh/Enhancements/crowd-control/CrowdControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void CrowdControl::Disable() {

void CrowdControl::ListenToServer() {
while (isEnabled) {
while (!connected) {
while (!connected && isEnabled) {
SPDLOG_TRACE("[CrowdControl] Attempting to make connection to server...");
tcpsock = SDLNet_TCP_Open(&ip);

Expand All @@ -112,8 +112,10 @@ void CrowdControl::ListenToServer() {
}
}

auto socketSet = SDLNet_AllocSocketSet(1);
SDLNet_TCP_AddSocket(socketSet, tcpsock);
SDLNet_SocketSet socketSet = SDLNet_AllocSocketSet(1);
if (tcpsock) {
SDLNet_TCP_AddSocket(socketSet, tcpsock);
}

// Listen to socket messages
while (connected && tcpsock && isEnabled) {
Expand Down
5 changes: 5 additions & 0 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ extern "C" void InitOTR() {
#ifdef ENABLE_CROWD_CONTROL
CrowdControl::Instance = new CrowdControl();
CrowdControl::Instance->Init();
if (CVar_GetS32("gCrowdControl", 0)) {
CrowdControl::Instance->Enable();
} else {
CrowdControl::Instance->Disable();
}
#endif
}

Expand Down

0 comments on commit a5f7478

Please sign in to comment.