diff --git a/src/servers/Server_Zone/Actor/Player.cpp b/src/servers/Server_Zone/Actor/Player.cpp index 5ad7819f..c2bcbf1c 100644 --- a/src/servers/Server_Zone/Actor/Player.cpp +++ b/src/servers/Server_Zone/Actor/Player.cpp @@ -914,7 +914,6 @@ uint32_t Core::Entity::Player::getLastPing() const return m_lastPing; } - void Core::Entity::Player::setVoiceId( uint8_t voiceId ) { m_voice = voiceId; diff --git a/src/servers/Server_Zone/Network/GameConnection.cpp b/src/servers/Server_Zone/Network/GameConnection.cpp index 3c0584ca..528b59cb 100644 --- a/src/servers/Server_Zone/Network/GameConnection.cpp +++ b/src/servers/Server_Zone/Network/GameConnection.cpp @@ -387,8 +387,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets: } session = g_serverZone.getSession( playerId ); } - - if( !session->isValid() ) //TODO: Catch more things in lobby and send real errors + else if( !session->isValid() || ( session->getPlayer() && session->getPlayer()->getLastPing() != 0 ) ) //TODO: Catch more things in lobby and send real errors { g_log.error( "[" + std::string(id) + "] Session INVALID, disconnecting" ); Disconnect(); diff --git a/src/servers/Server_Zone/ServerZone.cpp b/src/servers/Server_Zone/ServerZone.cpp index 883fa3a6..fe2bb905 100644 --- a/src/servers/Server_Zone/ServerZone.cpp +++ b/src/servers/Server_Zone/ServerZone.cpp @@ -280,16 +280,19 @@ void Core::ServerZone::mainLoop() auto pPlayer = it->second->getPlayer(); + // remove session of players marked for removel ( logoff / kick ) if( pPlayer->isMarkedForRemoval() && diff > 1 ) { it->second->close(); // if( it->second.unique() ) { + g_log.info("[" + std::to_string(it->second->getId() ) + "] Session removal" ); it = this->m_sessionMap.erase( it ); continue; } } + // remove sessions that simply timed out if( diff > 20 ) { g_log.info("[" + std::to_string(it->second->getId() ) + "] Session time out" );