mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
More fixes for bad sessions/incorrectly loaded players
This commit is contained in:
parent
93d2156549
commit
5bb4b8ba72
5 changed files with 23 additions and 3 deletions
Binary file not shown.
Before Width: | Height: | Size: 537 KiB After Width: | Height: | Size: 27 KiB |
|
@ -82,7 +82,7 @@ bool Core::Entity::Player::load( uint32_t charId, Core::SessionPtr pSession )
|
||||||
"cd.CFPenaltyUntil, "
|
"cd.CFPenaltyUntil, "
|
||||||
"cd.OpeningSequence, "
|
"cd.OpeningSequence, "
|
||||||
"cd.GMRank, "
|
"cd.GMRank, "
|
||||||
"cd.EquipDisplayFlags "
|
"cd.EquipDisplayFlags"
|
||||||
"FROM charabase AS c "
|
"FROM charabase AS c "
|
||||||
" INNER JOIN charadetail AS cd "
|
" INNER JOIN charadetail AS cd "
|
||||||
" ON c.CharacterId = cd.CharacterId "
|
" ON c.CharacterId = cd.CharacterId "
|
||||||
|
|
|
@ -389,6 +389,13 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
session = g_serverZone.getSession( playerId );
|
session = g_serverZone.getSession( playerId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !session->isValid() ) //TODO: Catch more things in lobby and send real errors
|
||||||
|
{
|
||||||
|
g_log.error( "[" + std::string(id) + "] Session INVALID, disconnecting" );
|
||||||
|
Disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if not set, set the session for this connection
|
// if not set, set the session for this connection
|
||||||
if( !m_pSession && session )
|
if( !m_pSession && session )
|
||||||
m_pSession = session;
|
m_pSession = session;
|
||||||
|
@ -423,8 +430,6 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
sendSinglePacket( &pPe );
|
sendSinglePacket( &pPe );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
Core::Session::Session( uint32_t sessionId )
|
Core::Session::Session( uint32_t sessionId )
|
||||||
: m_sessionId( sessionId )
|
: m_sessionId( sessionId )
|
||||||
|
, m_isValid( false )
|
||||||
, m_lastDataTime( static_cast< uint32_t >( time( nullptr ) ) )
|
, m_lastDataTime( static_cast< uint32_t >( time( nullptr ) ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -50,7 +51,12 @@ bool Core::Session::loadPlayer()
|
||||||
m_pPlayer = Entity::PlayerPtr( new Entity::Player() );
|
m_pPlayer = Entity::PlayerPtr( new Entity::Player() );
|
||||||
|
|
||||||
if( !m_pPlayer->load( m_sessionId, shared_from_this() ) )
|
if( !m_pPlayer->load( m_sessionId, shared_from_this() ) )
|
||||||
|
{
|
||||||
|
m_isValid = false;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_isValid = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -80,6 +86,11 @@ uint32_t Core::Session::getLastDataTime() const
|
||||||
return m_lastDataTime;
|
return m_lastDataTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Core::Session::isValid() const
|
||||||
|
{
|
||||||
|
return m_isValid;
|
||||||
|
}
|
||||||
|
|
||||||
void Core::Session::updateLastDataTime()
|
void Core::Session::updateLastDataTime()
|
||||||
{
|
{
|
||||||
m_lastDataTime = static_cast< uint32_t >( time( nullptr ) );
|
m_lastDataTime = static_cast< uint32_t >( time( nullptr ) );
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace Core {
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
bool isValid() const;
|
||||||
|
|
||||||
Entity::PlayerPtr getPlayer() const;
|
Entity::PlayerPtr getPlayer() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -44,6 +46,8 @@ namespace Core {
|
||||||
|
|
||||||
uint32_t m_lastDataTime;
|
uint32_t m_lastDataTime;
|
||||||
|
|
||||||
|
bool m_isValid;
|
||||||
|
|
||||||
Network::GameConnectionPtr m_pZoneConnection;
|
Network::GameConnectionPtr m_pZoneConnection;
|
||||||
Network::GameConnectionPtr m_pChatConnection;
|
Network::GameConnectionPtr m_pChatConnection;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue