diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index a2819c91..fe7a5a5f 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -1698,9 +1698,9 @@ void CliAuConn::AutoPing () { void CliAuConn::StopAutoPing () { critsect.Enter(); { - if (AsyncTimer * timer = pingTimer) { + if (pingTimer) { + AsyncTimerDeleteCallback(pingTimer, CliAuConnTimerDestroyed); pingTimer = nil; - AsyncTimerDeleteCallback(timer, CliAuConnTimerDestroyed); } } critsect.Leave(); @@ -1708,30 +1708,18 @@ void CliAuConn::StopAutoPing () { //============================================================================ void CliAuConn::TimerPing () { - -#if 0 - // if the time difference between when we last sent a ping and when we last - // heard from the server is >= 3x the ping interval, the socket is stale. - if (pingSendTimeMs && abs(int(pingSendTimeMs - lastHeardTimeMs)) >= kPingTimeoutMs) { - // ping timed out, disconnect the socket - AsyncSocketDisconnect(sock, true); - } - else -#endif - { - // Send a ping request - pingSendTimeMs = GetNonZeroTimeMs(); + // Send a ping request + pingSendTimeMs = GetNonZeroTimeMs(); - const uintptr_t msg[] = { - kCli2Auth_PingRequest, - pingSendTimeMs, - 0, // not a transaction - 0, // no payload - nil - }; + const uintptr_t msg[] = { + kCli2Auth_PingRequest, + pingSendTimeMs, + 0, // not a transaction + 0, // no payload + nil + }; - Send(msg, arrsize(msg)); - } + Send(msg, arrsize(msg)); } //============================================================================ diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp index 1c376e2f..3ec789de 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp @@ -445,9 +445,9 @@ void CliGmConn::AutoPing () { void CliGmConn::StopAutoPing () { critsect.Enter(); { - if (AsyncTimer * timer = pingTimer) { + if (pingTimer) { + AsyncTimerDeleteCallback(pingTimer, CliGmConnTimerDestroyed); pingTimer = nil; - AsyncTimerDeleteCallback(timer, CliGmConnTimerDestroyed); } } critsect.Leave(); @@ -455,27 +455,15 @@ void CliGmConn::StopAutoPing () { //============================================================================ void CliGmConn::TimerPing () { + // Send a ping request + pingSendTimeMs = GetNonZeroTimeMs(); -#if 0 - // if the time difference between when we last sent a ping and when we last - // heard from the server is >= 3x the ping interval, the socket is stale. - if (pingSendTimeMs && abs(int(pingSendTimeMs - lastHeardTimeMs)) >= kPingTimeoutMs) { - // ping timed out, disconnect the socket - AsyncSocketDisconnect(sock, true); - } - else -#endif - { - // Send a ping request - pingSendTimeMs = GetNonZeroTimeMs(); - - const uintptr_t msg[] = { - kCli2Game_PingRequest, - pingSendTimeMs - }; + const uintptr_t msg[] = { + kCli2Game_PingRequest, + pingSendTimeMs + }; - Send(msg, arrsize(msg)); - } + Send(msg, arrsize(msg)); } //============================================================================ diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp index 7334aa41..ee49e7cc 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp @@ -636,9 +636,9 @@ void CliGkConn::AutoPing () { void CliGkConn::StopAutoPing () { critsect.Enter(); { - if (AsyncTimer * timer = pingTimer) { + if (pingTimer) { + AsyncTimerDeleteCallback(pingTimer, CliGkConnTimerDestroyed); pingTimer = nil; - AsyncTimerDeleteCallback(timer, CliGkConnTimerDestroyed); } } critsect.Leave(); @@ -646,30 +646,18 @@ void CliGkConn::StopAutoPing () { //============================================================================ void CliGkConn::TimerPing () { - -#if 0 - // if the time difference between when we last sent a ping and when we last - // heard from the server is >= 3x the ping interval, the socket is stale. - if (pingSendTimeMs && abs(int(pingSendTimeMs - lastHeardTimeMs)) >= kPingTimeoutMs) { - // ping timed out, disconnect the socket - AsyncSocketDisconnect(sock, true); - } - else -#endif - { - // Send a ping request - pingSendTimeMs = GetNonZeroTimeMs(); + // Send a ping request + pingSendTimeMs = GetNonZeroTimeMs(); - const uintptr_t msg[] = { - kCli2GateKeeper_PingRequest, - pingSendTimeMs, - 0, // not a transaction - 0, // no payload - nil - }; + const uintptr_t msg[] = { + kCli2GateKeeper_PingRequest, + pingSendTimeMs, + 0, // not a transaction + 0, // no payload + nil + }; - //Send(msg, arrsize(msg)); - } + Send(msg, arrsize(msg)); } //============================================================================