aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorGyx <2359980687@qq.com>2012-03-29 14:43:34 +0800
committerGyx <2359980687@qq.com>2012-03-29 14:43:34 +0800
commit5b7493fc6676aa1f5ae762b9b0d5d12a01a30e14 (patch)
tree6daa90f3ff357f5b1962e7329e870c7c09978be7 /src/server/game/Server
parente77f51df5d76c0afc5389d1c006c875e1cd20560 (diff)
Core/Misc: Code style and remove unused define.
Signed-off-by: Gyx <2359980687@qq.com>
Diffstat (limited to 'src/server/game/Server')
-rwxr-xr-xsrc/server/game/Server/Protocol/WorldLog.cpp1
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp3
-rwxr-xr-xsrc/server/game/Server/WorldSocket.cpp44
-rwxr-xr-xsrc/server/game/Server/WorldSocket.h2
-rwxr-xr-xsrc/server/game/Server/WorldSocketMgr.cpp10
5 files changed, 31 insertions, 29 deletions
diff --git a/src/server/game/Server/Protocol/WorldLog.cpp b/src/server/game/Server/Protocol/WorldLog.cpp
index 5b1a3af996f..38b13dff095 100755
--- a/src/server/game/Server/Protocol/WorldLog.cpp
+++ b/src/server/game/Server/Protocol/WorldLog.cpp
@@ -34,6 +34,7 @@ WorldLog::~WorldLog()
{
if (i_file != NULL)
fclose(i_file);
+
i_file = NULL;
}
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 9dcacb71824..be6561c2633 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -195,7 +195,7 @@ void WorldSession::SendPacket(WorldPacket const* packet)
}
#endif // !TRINITY_DEBUG
- if (m_Socket->SendPacket (*packet) == -1)
+ if (m_Socket->SendPacket(*packet) == -1)
m_Socket->CloseSocket();
}
@@ -922,6 +922,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
{
if (data.rpos() + 4 > data.size())
return;
+
uint32 size;
data >> size;
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index cf9ec7dadc4..64137dfe7c7 100755
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -152,7 +152,7 @@ const std::string& WorldSocket::GetRemoteAddress (void) const
return m_Address;
}
-int WorldSocket::SendPacket (const WorldPacket& pct)
+int WorldSocket::SendPacket(const WorldPacket& pct)
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
@@ -252,7 +252,7 @@ int WorldSocket::open (void *a)
if (peer().get_remote_addr(remote_addr) == -1)
{
- sLog->outError ("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
+ sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -277,7 +277,7 @@ int WorldSocket::open (void *a)
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
+ sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -496,7 +496,7 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
- sLog->outError ("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
+ sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName() : "<none>",
@@ -602,7 +602,7 @@ int WorldSocket::handle_input_missing_data (void)
// hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct)
{
- sLog->outError ("Forcing close on input m_RecvWPct = NULL");
+ sLog->outError("Forcing close on input m_RecvWPct = NULL");
errno = EINVAL;
return -1;
}
@@ -648,7 +648,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// would be good to store errno from reactor with errno guard
- sLog->outError ("WorldSocket::cancel_wakeup_output");
+ sLog->outError("WorldSocket::cancel_wakeup_output");
return -1;
}
@@ -667,7 +667,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError ("WorldSocket::schedule_wakeup_output");
+ sLog->outError("WorldSocket::schedule_wakeup_output");
return -1;
}
@@ -715,7 +715,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
case CMSG_AUTH_SESSION:
if (m_Session)
{
- sLog->outError ("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
+ sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
return -1;
}
@@ -744,7 +744,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
}
else
{
- sLog->outError ("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
+ sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1;
}
}
@@ -788,9 +788,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
packet.Initialize(SMSG_AUTH_RESPONSE, 1);
packet << uint8(AUTH_REJECT);
- SendPacket (packet);
+ SendPacket(packet);
- sLog->outError ("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
+ sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1;
}
@@ -824,9 +824,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_UNKNOWN_ACCOUNT);
- SendPacket (packet);
+ SendPacket(packet);
- sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
+ sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
}
@@ -860,7 +860,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_FAILED);
- SendPacket (packet);
+ SendPacket(packet);
sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1;
@@ -924,9 +924,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
{
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_BANNED);
- SendPacket (packet);
+ SendPacket(packet);
- sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
+ sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1;
}
@@ -938,9 +938,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
WorldPacket Packet (SMSG_AUTH_RESPONSE, 1);
Packet << uint8 (AUTH_UNAVAILABLE);
- SendPacket (packet);
+ SendPacket(packet);
- sLog->outDetail ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
+ sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1;
}
@@ -960,9 +960,9 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
packet << uint8 (AUTH_FAILED);
- SendPacket (packet);
+ SendPacket(packet);
- sLog->outError ("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed).");
+ sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (authentification failed).");
return -1;
}
@@ -1067,7 +1067,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
m_Session->SetLatency (latency);
else
{
- sLog->outError ("WorldSocket::HandlePing: peer sent CMSG_PING, "
+ sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, "
" address = %s",
GetRemoteAddress().c_str());
@@ -1077,5 +1077,5 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
WorldPacket packet (SMSG_PONG, 4);
packet << ping;
- return SendPacket (packet);
+ return SendPacket(packet);
}
diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h
index 3396803ff62..b8080b128f2 100755
--- a/src/server/game/Server/WorldSocket.h
+++ b/src/server/game/Server/WorldSocket.h
@@ -108,7 +108,7 @@ class WorldSocket : public WorldHandler
/// Send A packet on the socket, this function is reentrant.
/// @param pct packet to send
/// @return -1 of failure
- int SendPacket (const WorldPacket& pct);
+ int SendPacket(const WorldPacket& pct);
/// Add reference to this object.
long AddReference (void);
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index 00a8b263847..d357651a5bf 100755
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (num_threads <= 0)
{
- sLog->outError ("Network.Threads is wrong in your config file");
+ sLog->outError("Network.Threads is wrong in your config file");
return -1;
}
@@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_SockOutUBuff <= 0)
{
- sLog->outError ("Network.OutUBuff is wrong in your config file");
+ sLog->outError("Network.OutUBuff is wrong in your config file");
return -1;
}
@@ -263,7 +263,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1)
{
- sLog->outError ("Failed to open acceptor, check if the port is free");
+ sLog->outError("Failed to open acceptor, check if the port is free");
return -1;
}
@@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*) & m_SockOutKBuff,
sizeof (int)) == -1 && errno != ENOTSUP)
{
- sLog->outError ("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
+ sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
return -1;
}
}
@@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*)&ndoption,
sizeof (int)) == -1)
{
- sLog->outError ("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
+ sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
return -1;
}
}