diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 9c7eb949f..663256dd7 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -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; } diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 18e51a89a..6e66f8151 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -100,9 +100,14 @@ void Player::setHandshake() handshakeCounter = numeric_limits::max(); } -int Player::handshakeAttempts() +void Player::incrementHandshakeAttempts() { - return handshakeCounter++; + handshakeCounter++; +} + +int Player::getHandshakeAttempts() +{ + return handshakeCounter; } diff --git a/apps/openmw-mp/Player.hpp b/apps/openmw-mp/Player.hpp index aa52d7574..a956a4a52 100644 --- a/apps/openmw-mp/Player.hpp +++ b/apps/openmw-mp/Player.hpp @@ -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; };