本文整理汇总了C++中ProcessQueryCallbacks函数的典型用法代码示例。如果您正苦于以下问题:C++ ProcessQueryCallbacks函数的具体用法?C++ ProcessQueryCallbacks怎么用?C++ ProcessQueryCallbacks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ProcessQueryCallbacks函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: UpdateTimeOutTime
/// Update the WorldSession (triggered by World update)
bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
/// Update Timeout timer.
UpdateTimeOutTime(diff);
///- Before we process anything:
/// If necessary, kick the player from the character select screen
if (IsConnectionIdle())
m_Socket->CloseSocket();
UpdateNodeIO(diff, updater);
UpdateClientIO(diff, updater);
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:Zakamurite,项目名称:TrilliumEMU,代码行数:37,代码来源:WorldSession.cpp
示例2: UpdateTimeOutTime
//.........这里部分代码省略.........
LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT",
"the player has not logged in yet and not recently logout");
else
{
// not expected _player or must checked in packet handler
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player has not logged in yet");
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world");
else
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
// single from authed time opcodes send in to after logout time
// and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)",
GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
case STATUS_UNHANDLED:
sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)",
GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
}
}
catch(ByteBufferException &)
{
sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
if (sLog->IsOutDebug())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
packet->hexlike();
}
}
}
if (deletePacket)
delete packet;
}
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && GetPlayer() && _warden)
_warden->Update();
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:Arthus,项目名称:TrinityCore,代码行数:101,代码来源:WorldSession.cpp
示例3: UpdateTimeOutTime
//.........这里部分代码省略.........
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
break;
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT:
if (!_player && !m_playerRecentlyLogout)
{
LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT", "the player has not logged in yet and not recently logout");
}
else
{
// not expected _player or must checked in packet hanlder
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player has not logged in yet");
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world");
else
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
// single from authed time opcodes send in to after logout time
// and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
if (strcmp(LookupOpcodeName(packet->GetOpcode()), "UNKNOWN") == 0)
sLog->outDebug(LOG_FILTER_NETWORKIO, "received not found opcode 0x%.4X", packet->GetOpcode());
else
sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)", GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
case STATUS_UNHANDLED:
sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)", GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
}
}
catch (ByteBufferException &)
{
sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
if (sLog->IsOutDebug())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
packet->hexlike();
}
}
}
delete packet;
}
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:814077430,项目名称:ArkCORE,代码行数:101,代码来源:WorldSession.cpp
示例4: getMSTime
//.........这里部分代码省略.........
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
// some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes
// however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process.
if (packet->GetOpcode() == CMSG_CHAR_ENUM)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
#ifdef ELUNA
if (!sEluna->OnPacketReceive(this, *packet))
break;
#endif
(this->*opHandle->handler)(*packet);
if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE) && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerName(false).c_str());
break;
case STATUS_UNHANDLED:
sLog->outError(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerName(false).c_str());
break;
}
}
catch(ByteBufferException &)
{
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
packet->hexlike();
}
nbPacket++;
std::map<uint32, OpcodeInfo>::iterator itr = pktHandle.find(packet->GetOpcode());
if (itr == pktHandle.end())
pktHandle.insert(std::make_pair(packet->GetOpcode(), OpcodeInfo(1, getMSTime() - pktTime)));
else
{
OpcodeInfo& data = (*itr).second;
data.nbPkt += 1;
data.totalTime += getMSTime() - pktTime;
}
if (deletePacket)
delete packet;
#define MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE 500
processedPackets++;
//process only a max amout of packets in 1 Update() call.
//Any leftover will be processed in next update
if (processedPackets > MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE)
break;
}
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && GetPlayer() && _warden)
_warden->Update();
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
sessionDiff = getMSTime() - sessionDiff;
if (sessionDiff > 50)
{
sLog->outInfo(LOG_FILTER_PLAYER, "Session of account [%u] take more than 50 ms to execute (%u ms)", GetAccountId(), sessionDiff);
for (auto itr : pktHandle)
sLog->outInfo(LOG_FILTER_PLAYER, "Session of account -----> %u %s (%u ms)", itr.second.nbPkt, GetOpcodeNameForLogging((Opcodes)itr.first).c_str(), itr.second.totalTime);
}
return true;
}
开发者ID:RezolveX,项目名称:MistCore_Eluna,代码行数:101,代码来源:WorldSession.cpp
示例5: UpdateTimeOutTime
//.........这里部分代码省略.........
LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT",
"the player has not logged in yet and not recently logout");
else
{
// not expected _player or must checked in packet hanlder
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle->Handler)(*packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player has not logged in yet");
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world");
else
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle->Handler)(*packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
// some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes
// however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process.
if (packet->GetOpcode() == CMSG_CHAR_ENUM)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle->Handler)(*packet);
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
TC_LOG_ERROR("network.opcode", "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode(), false).c_str()
, GetPlayerInfo().c_str());
break;
case STATUS_UNHANDLED:
TC_LOG_ERROR("network.opcode", "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode(), false).c_str()
, GetPlayerInfo().c_str());
break;
}
}
catch (ByteBufferException const&)
{
TC_LOG_ERROR("network", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %s) from client %s, accountid=%i. Skipped packet.",
GetOpcodeNameForLogging(packet->GetOpcode(), false).c_str(), GetRemoteAddress().c_str(), GetAccountId());
packet->hexlike();
}
if (deletePacket)
delete packet;
deletePacket = true;
#define MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE 100
processedPackets++;
//process only a max amout of packets in 1 Update() call.
//Any leftover will be processed in next update
if (processedPackets > MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE)
break;
}
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && GetPlayer() && _warden)
_warden->Update();
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:BHollowell,项目名称:SkyFire_5xx,代码行数:101,代码来源:WorldSession.cpp
示例6: UpdateTimeOutTime
//.........这里部分代码省略.........
sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)",
GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
}
}
catch (ByteBufferException &)
{
sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
if (sLog->IsOutDebug())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
packet->hexlike();
}
}
}
uint32 temporary = getMSTime();
processedOpcodes.push_back(std::pair<uint32, uint32>(packet->GetOpcode(), getMSTimeDiff(currentMSTime, temporary)));
if (deletePacket)
delete packet;
deletePacket = true;
/*#define MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE 50
processedPackets++;
//process only a max amout of packets in 1 Update() call.
//Any leftover will be processed in next update
if (processedPackets > MAX_PROCESSED_PACKETS_IN_SAME_WORLDSESSION_UPDATE)
{
output = true;
break;
}
#define MAX_PROCESS_MSTIME_IN_SAME_WORLDSESSION_UPDATE 5
currentMSTime = getMSTime();
if (getUSTimeDiff(msTime, currentMSTime) > MAX_PROCESS_MSTIME_IN_SAME_WORLDSESSION_UPDATE)
{
output = true;
break;
}*/
}
/*if (output)
{
std::stringstream ss;
ss << "Session: " << GetAccountId() << " Player: " << GetPlayerName();
std::list<std::pair<uint32, uint32> >::iterator itr = processedOpcodes.begin();
for (; itr != processedOpcodes.end(); ++itr)
ss << " " << itr->first << "-" << itr->second << "ms";
sLog->outPerformance(ss.str().c_str());
}*/
ProcessQueryCallbacks();
if (_newNode)
{
if (Player *player = GetPlayer())
{
if (player->IsSaveCommited())
{
WorldPacket data(NODE_MISC_DATA);
data << uint32(CL_DEF_TRANSFER_TO_NODE);
data << _newNode;
SendPacket(&data);
_newNode = 0;
}
}
}
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
expireTime -= expireTime > diff ? diff : expireTime;
if (expireTime < diff || forceExit)
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:Allowed,项目名称:Strawberry335,代码行数:101,代码来源:WorldSession.cpp
示例7: UpdateTimeOutTime
//.........这里部分代码省略.........
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "the player is still in world");
else
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "the player not pass queue yet");
break;
}
// single from authed time opcodes send in to after logout time
// and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
sLog->outError("SESSION: received not allowed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
case STATUS_UNHANDLED:
sLog->outDebug("SESSION: received not handled opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
}
}
catch(ByteBufferException &)
{
sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
if (sLog->IsOutDebug())
{
sLog->outDebug("Dumping error causing packet:");
packet->hexlike();
}
}
}
delete packet;
}
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
//Playerbot mod - Process player bot packets
//The PlayerbotAI class adds to the packet queue to simulate a real player
//since Playerbots are known to the World obj only its master's
//WorldSession object we need to process all master's bot's packets.
for(PlayerBotMap::const_iterator itr = GetPlayerBotsBegin(); itr != GetPlayerBotsEnd(); ++itr)
{
Player *const botPlayer = itr->second;
WorldSession *const pBotWorldSession = botPlayer->GetSession();
if(botPlayer->IsBeingTeleportedFar())
{
pBotWorldSession->HandleMoveWorldportAckOpcode();
} else if(botPlayer->IsInWorld())
{
WorldPacket *packet;
while(pBotWorldSession->_recvQueue.next(packet))
{
OpcodeHandler &opHandle = opcodeTable[packet->GetOpcode()];
(pBotWorldSession->*opHandle.handler)(*packet);
delete packet;
}
}
}
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:Erotix8210,项目名称:prydevserv_backup,代码行数:101,代码来源:WorldSession.cpp
示例8: UpdateTimeOutTime
//.........这里部分代码省略.........
case STATUS_AUTHED:
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
// some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes
// however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process.
if (packet->GetOpcode() == CMSG_CHAR_ENUM)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerInfo().c_str());
break;
case STATUS_UNHANDLED:
sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerInfo().c_str());
break;
}
}
catch(ByteBufferException &)
{
sLog->outError(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
packet->hexlike();
}
}
if (deletePacket)
delete packet;
}
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
ProcessQueryCallbacks();
// Playerbot mod - Process player bot packets
// The PlayerbotAI class adds to the packet queue to simulate a real player
// since Playerbots are known to the World obj only by its master's WorldSession object
// we need to process all master's bot's packets.
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
{
for (PlayerBotMap::const_iterator itr = GetPlayer()->GetPlayerbotMgr()->GetPlayerBotsBegin(); itr != GetPlayer()->GetPlayerbotMgr()->GetPlayerBotsEnd(); ++itr)
{
Player* const botPlayer = itr->second;
if (!botPlayer) continue;
WorldSession* const pBotWorldSession = botPlayer->GetSession();
if (!pBotWorldSession) continue;
if (botPlayer->IsBeingTeleported())
botPlayer->GetPlayerbotAI()->HandleTeleportAck();
else if (botPlayer->IsInWorld())
{
WorldPacket* packet;
while (!_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket &&
pBotWorldSession->_recvQueue.next(packet, updater))
{
OpcodeHandler& opHandle = opcodeTable[packet->GetOpcode()];
//sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(pBotWorldSession->*opHandle.handler)(*packet);
delete packet;
}
}
}
}
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && GetPlayer() && _warden)
_warden->Update();
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:GlobalWoW,项目名称:TrinityCore,代码行数:101,代码来源:WorldSession.cpp
示例9: UpdateTimeOutTime
//.........这里部分代码省略.........
{
// not expected _player or must checked in packet hanlder
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle->Handler)(*packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player has not logged in yet");
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world");
else
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle->Handler)(*packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
// some auth opcodes can be recieved before STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes
// however when we recieve CMSG_CHAR_ENUM we are surely no longer during the logout process.
if (packet->GetOpcode() == CMSG_CHAR_ENUM)
m_playerRecentlyLogout = false;
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle->Handler)(*packet);
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerInfo().c_str());
break;
case STATUS_UNHANDLED:
sLog->outInfo(LOG_FILTER_BAD_OPCODE_HANDLER, "STATUS_UNHANDLED: %s (len: %u)", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), packet->size());
sLog->outError(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerInfo().c_str());
break;
}
}
catch(ByteBufferException &)
{
sLog->outInfo(LOG_FILTER_BAD_OPCODE_HANDLER, "EXCEPTION: %s (len: %u)", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), packet->size());
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
packet->hexlike();
}
opcodeProcessTime = GetMSTimeDiffToNow(opcodeStartTime);
if (opcodeProcessTime >= opcodeMinTime)
{
PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_SLOW_OPCODE);
stmt->setUInt32(0, packet->GetOpcode());
stmt->setUInt32(1, opcodeProcessTime);
WorldDatabase.Execute(stmt);
}
if (deletePacket)
delete packet;
}
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
ProcessQueryCallbacks();
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && GetPlayer() && _warden)
_warden->Update();
///- Cleanup socket pointer if need
if (m_Socket && m_Socket->IsClosed())
{
expireTime -= expireTime > diff ? diff : expireTime;
if (expireTime < diff || forceExit)
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
}
if (!m_Socket)
return false; //Will remove this session from the world session map
}
return true;
}
开发者ID:Cryostorm,项目名称:InfinityCore,代码行数:101,代码来源:WorldSession.cpp
示例10: UpdateTimeOutTime
//.........这里部分代码省略.........
HandleMovementOpcodes(*movementPacket);
delete movementPacket;
movementPacket = NULL;
}
sScriptMgr->OnPacketReceive(this, *packet);
#ifdef ELUNA
if (!sEluna->OnPacketReceive(this, *packet))
break;
#endif
(this->*opHandle.handler)(*packet);
}
}
break;
case STATUS_TRANSFER:
if (_player && !_player->IsInWorld())
{
if (movementPacket)
{
delete movementPacket;
movementPacket = NULL;
}
sScriptMgr->OnPacketReceive(this, *packet);
#ifdef ELUNA
if (!sEluna->OnPacketReceive(this, *packet))
break;
#endif
(this->*opHandle.handler)(*packet);
}
break;
case STATUS_AUTHED:
if (m_inQueue) // prevent cheating
break;
sScriptMgr->OnPacketReceive(this, *packet);
#ifdef ELUNA
if (!sEluna->OnPacketReceive(this, *packet))
break;
#endif
(this->*opHandle.handler)(*packet);
break;
case STATUS_NEVER:
break;
case STATUS_UNHANDLED:
break;
}
}
catch(ByteBufferException &)
{
sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
if (sLog->IsOutDebug())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
packet->hexlike();
}
}
}
if (deletePacket)
delete packet;
else
deletePacket = true;
if (++processedPackets >= 150) // limit (by count) packets processed in one update, prevent DDoS
break;
if (getMSTimeDiff(_startMSTime, getMSTime()) >= 3) // limit (by time) packets processed in one update, prevent DDoS
break;
}
if (movementPacket)
{
if (_player && _player->IsInWorld())
HandleMovementOpcodes(*movementPacket);
delete movementPacket;
}
if (m_Socket && !m_Socket->IsClosed())
ProcessQueryCallbacks();
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && !m_Socket->IsClosed() && _warden)
_warden->Update();
if (m_Socket && m_Socket->IsClosed())
{
m_Socket->RemoveReference();
m_Socket = NULL;
}
if (!m_Socket)
return false;
}
return true;
}
开发者ID:lineagedr,项目名称:azerothcore-wotlk,代码行数:101,代码来源:WorldSession.cpp
注:本文中的ProcessQueryCallbacks函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论