Revamp CNShared logic

* Use a specialized connection object
* Copy the Player object less frequently
* Use a randomly generated serial key for shard auth
* Refuse invalid shard connection attempts
* Clean up connection metadata when a Player joins the shard
* Prune abandoned connections when they time out
This commit is contained in:
2022-07-24 00:16:04 +02:00
parent c5dd745aa1
commit 741bfb675b
6 changed files with 78 additions and 48 deletions

View File

@@ -99,14 +99,7 @@ void CNShardServer::_killConnection(CNSocket* cns) {
if (PlayerManager::players.find(cns) == PlayerManager::players.end())
return;
Player* plr = PlayerManager::getPlayer(cns);
int64_t key = plr->SerialKey;
PlayerManager::removePlayer(cns); // removes the player from the list and saves it to DB
// remove from CNShared
CNShared::erasePlayer(key);
}
void CNShardServer::killConnection(CNSocket *cns) {