* Small code cleanups and code style apply

This commit is contained in:
Vladimir 2008-10-16 14:20:07 +04:00
parent 8c6c66afe0
commit 58a1dd7209
2 changed files with 19 additions and 20 deletions

View file

@ -379,7 +379,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
data << (uint8)CHAR_CREATE_SUCCESS; data << (uint8)CHAR_CREATE_SUCCESS;
SendPacket( &data ); SendPacket( &data );
std::string IP_str = GetRemoteAddress().c_str(); std::string IP_str = GetRemoteAddress();
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
} }

View file

@ -96,7 +96,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
{ {
if (!m_Socket) if (!m_Socket)
return; return;
#ifdef MANGOS_DEBUG #ifdef MANGOS_DEBUG
// Code for network use statistic // Code for network use statistic
static uint64 sendPacketCount = 0; static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0; static uint64 sendPacketBytes = 0;
@ -128,12 +130,11 @@ void WorldSession::SendPacket(WorldPacket const* packet)
sendLastPacketCount = 1; sendLastPacketCount = 1;
sendLastPacketBytes = packet->wpos(); // wpos is real written size sendLastPacketBytes = packet->wpos(); // wpos is real written size
} }
#endif // !MANGOS_DEBUG
#endif // !MANGOS_DEBUG
if (m_Socket->SendPacket (*packet) == -1) if (m_Socket->SendPacket (*packet) == -1)
{
m_Socket->CloseSocket (); m_Socket->CloseSocket ();
}
} }
/// Add an incoming packet to the queue /// Add an incoming packet to the queue
@ -154,8 +155,7 @@ void WorldSession::logUnexpectedOpcode(WorldPacket* packet, const char *reason)
/// Update the WorldSession (triggered by World update) /// Update the WorldSession (triggered by World update)
bool WorldSession::Update(uint32 /*diff*/) bool WorldSession::Update(uint32 /*diff*/)
{ {
if (m_Socket) if (m_Socket && m_Socket->IsClosed ())
if (m_Socket->IsClosed ())
{ {
m_Socket->RemoveReference (); m_Socket->RemoveReference ();
m_Socket = NULL; m_Socket = NULL;
@ -386,7 +386,8 @@ void WorldSession::LogoutPlayer(bool Save)
///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline ///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
//No SQL injection as AccountId is uint32 //No SQL injection as AccountId is uint32
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'", GetAccountId()); CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'",
GetAccountId());
sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" ); sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" );
} }
@ -399,9 +400,7 @@ void WorldSession::LogoutPlayer(bool Save)
void WorldSession::KickPlayer() void WorldSession::KickPlayer()
{ {
if (m_Socket) if (m_Socket)
{
m_Socket->CloseSocket (); m_Socket->CloseSocket ();
}
} }
/// Cancel channeling handler /// Cancel channeling handler