fix(Core/PacketIO): Reintroduce requeueing packets that are sent during login but need you to be logged in (#15145)
This commit is contained in:
@@ -140,7 +140,6 @@ WorldSession::WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldS
|
|||||||
|
|
||||||
_offlineTime = 0;
|
_offlineTime = 0;
|
||||||
_kicked = false;
|
_kicked = false;
|
||||||
_shouldSetOfflineInDB = true;
|
|
||||||
|
|
||||||
_timeSyncNextCounter = 0;
|
_timeSyncNextCounter = 0;
|
||||||
_timeSyncTimer = 0;
|
_timeSyncTimer = 0;
|
||||||
@@ -174,8 +173,7 @@ WorldSession::~WorldSession()
|
|||||||
while (_recvQueue.next(packet))
|
while (_recvQueue.next(packet))
|
||||||
delete packet;
|
delete packet;
|
||||||
|
|
||||||
if (GetShouldSetOfflineInDB())
|
LoginDatabase.Execute("UPDATE account SET online = 0 WHERE id = {};", GetAccountId()); // One-time query
|
||||||
LoginDatabase.Execute("UPDATE account SET online = 0 WHERE id = {};", GetAccountId()); // One-time query
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& WorldSession::GetPlayerName() const
|
std::string const& WorldSession::GetPlayerName() const
|
||||||
@@ -332,7 +330,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||||||
//! the client to be in world yet. We will re-add the packets to the bottom of the queue and process them later.
|
//! the client to be in world yet. We will re-add the packets to the bottom of the queue and process them later.
|
||||||
if (!m_playerRecentlyLogout)
|
if (!m_playerRecentlyLogout)
|
||||||
{
|
{
|
||||||
// requeuePackets.push_back(packet);
|
requeuePackets.push_back(packet);
|
||||||
deletePacket = false;
|
deletePacket = false;
|
||||||
|
|
||||||
LOG_DEBUG("network", "Re-enqueueing packet with opcode {} with with status STATUS_LOGGEDIN. "
|
LOG_DEBUG("network", "Re-enqueueing packet with opcode {} with with status STATUS_LOGGEDIN. "
|
||||||
@@ -517,7 +515,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||||||
|
|
||||||
if (!m_Socket)
|
if (!m_Socket)
|
||||||
{
|
{
|
||||||
return false;
|
return false; //Will remove this session from the world session map
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1066,8 +1066,6 @@ public: // opcodes handlers
|
|||||||
uint32 GetOfflineTime() const { return _offlineTime; }
|
uint32 GetOfflineTime() const { return _offlineTime; }
|
||||||
bool IsKicked() const { return _kicked; }
|
bool IsKicked() const { return _kicked; }
|
||||||
void SetKicked(bool val) { _kicked = val; }
|
void SetKicked(bool val) { _kicked = val; }
|
||||||
void SetShouldSetOfflineInDB(bool val) { _shouldSetOfflineInDB = val; }
|
|
||||||
bool GetShouldSetOfflineInDB() const { return _shouldSetOfflineInDB; }
|
|
||||||
bool IsSocketClosed() const;
|
bool IsSocketClosed() const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1177,7 +1175,6 @@ private:
|
|||||||
ObjectGuid m_currentBankerGUID;
|
ObjectGuid m_currentBankerGUID;
|
||||||
uint32 _offlineTime;
|
uint32 _offlineTime;
|
||||||
bool _kicked;
|
bool _kicked;
|
||||||
bool _shouldSetOfflineInDB;
|
|
||||||
// Packets cooldown
|
// Packets cooldown
|
||||||
time_t _calendarEventCreationCooldown;
|
time_t _calendarEventCreationCooldown;
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,6 @@ void World::AddSession_(WorldSession* s)
|
|||||||
{
|
{
|
||||||
WorldSession* tmp = iter->second;
|
WorldSession* tmp = iter->second;
|
||||||
_offlineSessions.erase(iter);
|
_offlineSessions.erase(iter);
|
||||||
tmp->SetShouldSetOfflineInDB(false);
|
|
||||||
delete tmp;
|
delete tmp;
|
||||||
}
|
}
|
||||||
oldSession->SetOfflineTime(GameTime::GetGameTime().count());
|
oldSession->SetOfflineTime(GameTime::GetGameTime().count());
|
||||||
@@ -298,7 +297,6 @@ void World::AddSession_(WorldSession* s)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldSession->SetShouldSetOfflineInDB(false); // pussywizard: don't set offline in db because new session for that acc is already created
|
|
||||||
delete oldSession;
|
delete oldSession;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2975,7 +2973,6 @@ void World::UpdateSessions(uint32 diff)
|
|||||||
{
|
{
|
||||||
WorldSession* tmp = iter->second;
|
WorldSession* tmp = iter->second;
|
||||||
_offlineSessions.erase(iter);
|
_offlineSessions.erase(iter);
|
||||||
tmp->SetShouldSetOfflineInDB(false);
|
|
||||||
delete tmp;
|
delete tmp;
|
||||||
}
|
}
|
||||||
pSession->SetOfflineTime(GameTime::GetGameTime().count());
|
pSession->SetOfflineTime(GameTime::GetGameTime().count());
|
||||||
@@ -2991,8 +2988,6 @@ void World::UpdateSessions(uint32 diff)
|
|||||||
if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
|
if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
|
||||||
_disconnects[pSession->GetAccountId()] = GameTime::GetGameTime().count();
|
_disconnects[pSession->GetAccountId()] = GameTime::GetGameTime().count();
|
||||||
_sessions.erase(itr);
|
_sessions.erase(itr);
|
||||||
if (_offlineSessions.find(pSession->GetAccountId()) != _offlineSessions.end()) // pussywizard: don't set offline in db because offline session for that acc is present (character is in world)
|
|
||||||
pSession->SetShouldSetOfflineInDB(false);
|
|
||||||
delete pSession;
|
delete pSession;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3009,8 +3004,6 @@ void World::UpdateSessions(uint32 diff)
|
|||||||
if (!pSession->GetPlayer() || pSession->GetOfflineTime() + 60 < currTime || pSession->IsKicked())
|
if (!pSession->GetPlayer() || pSession->GetOfflineTime() + 60 < currTime || pSession->IsKicked())
|
||||||
{
|
{
|
||||||
_offlineSessions.erase(itr);
|
_offlineSessions.erase(itr);
|
||||||
if (_sessions.find(pSession->GetAccountId()) != _sessions.end())
|
|
||||||
pSession->SetShouldSetOfflineInDB(false); // pussywizard: don't set offline in db because new session for that acc is already created
|
|
||||||
delete pSession;
|
delete pSession;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user