1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-03 17:27:47 +00:00

Players wont be able to connect anymore if a session is already present

This commit is contained in:
Mordred 2017-11-16 23:06:33 +01:00
parent b58acb90af
commit 1d4655f750
3 changed files with 4 additions and 3 deletions

View file

@ -910,7 +910,6 @@ uint32_t Core::Entity::Player::getLastPing() const
return m_lastPing;
}
void Core::Entity::Player::setVoiceId( uint8_t voiceId )
{
m_voice = voiceId;

View file

@ -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();

View file

@ -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" );