mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
Fix CC connection bugs (#2367)
This commit is contained in:
parent
750ae907c2
commit
a5f7478b99
@ -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);
|
||||
|
||||
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user