1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-27 17:39:41 +00:00

[Server] Split up handshake handling into multiple functions for debug

Unfortunately, the handshake attempt limit implemented in 4ebfcc4a21 for 0.7 and then ported over to 0.6 in a3a341fee6 does not appear to work properly, which is why gathering more information on it is important.
This commit is contained in:
David Cernat 2018-04-09 15:25:50 +03:00
parent c132dc70d2
commit 34893ff631
3 changed files with 15 additions and 5 deletions

View file

@ -116,8 +116,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->isHandshaked())
{
player->incrementHandshakeAttempts();
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Have not completed handshake with player %d", player->getId());
if (player->handshakeAttempts() > 5)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Attempts so far: %i", player->getHandshakeAttempts());
if (player->getHandshakeAttempts() > 5)
kickPlayer(player->guid);
return;
}

View file

@ -100,9 +100,14 @@ void Player::setHandshake()
handshakeCounter = numeric_limits<int>::max();
}
int Player::handshakeAttempts()
void Player::incrementHandshakeAttempts()
{
return handshakeCounter++;
handshakeCounter++;
}
int Player::getHandshakeAttempts()
{
return handshakeCounter;
}

View file

@ -58,7 +58,8 @@ public:
void setId(unsigned short id);
bool isHandshaked();
int handshakeAttempts();
int getHandshakeAttempts();
void incrementHandshakeAttempts();
void setHandshake();
void setLoadState(int state);
@ -73,8 +74,8 @@ public:
private:
CellController::TContainer cells;
int handshakeCounter;
int loadState;
int handshakeCounter;
};