Fix early CNShared timeout

Revisiting this again; the issue was that the comparison operator was
facing the wrong way, so connections were being pruned every 30 seconds
or less. This was effectively a race condition kicking an unlucky player
every so often when pruning happened exactly during an attempt to enter
the game.

Now that the proper timeout is being enforced, I've reduced it to 5
minutes, down from 15, since it really doesn't need to be that long.
This commit is contained in:
dongresource 2022-12-11 18:35:22 +01:00
parent 741b898230
commit 100b4605ec
2 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ void CNShared::pruneLoginMetadata(CNServer *serv, time_t currTime) {
auto& sk = it->first; auto& sk = it->first;
auto& lm = it->second; auto& lm = it->second;
if (lm->timestamp + CNSHARED_TIMEOUT > currTime) { if (currTime > lm->timestamp + CNSHARED_TIMEOUT) {
std::cout << "[WARN] Pruning hung connection attempt" << std::endl; std::cout << "[WARN] Pruning hung connection attempt" << std::endl;
// deallocate object and remove map entry // deallocate object and remove map entry

View File

@ -11,9 +11,9 @@
#include "Player.hpp" #include "Player.hpp"
/* /*
* Connecions time out after 15 minutes, checked every 30 seconds. * Connecions time out after 5 minutes, checked every 30 seconds.
*/ */
#define CNSHARED_TIMEOUT 900000 #define CNSHARED_TIMEOUT 300000
#define CNSHARED_PERIOD 30000 #define CNSHARED_PERIOD 30000
struct LoginMetadata { struct LoginMetadata {