feat(Core/Sockets): replace ACE_ASSERT to default core ASSERT (#4950)

This commit is contained in:
Kargatum
2021-03-25 09:09:13 +07:00
committed by GitHub
parent fb5d2fa2e5
commit 10fa49f5bd
3 changed files with 18 additions and 19 deletions

View File

@@ -167,11 +167,11 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
{ {
// Put the packet on the buffer. // Put the packet on the buffer.
if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1) if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1)
ACE_ASSERT (false); ABORT();
if (!pct.empty()) if (!pct.empty())
if (m_OutBuffer->copy((char*) pct.contents(), pct.size()) == -1) if (m_OutBuffer->copy((char*) pct.contents(), pct.size()) == -1)
ACE_ASSERT (false); ABORT();
} }
else else
{ {
@@ -463,9 +463,8 @@ int WorldSocket::Update(void)
int WorldSocket::handle_input_header(void) int WorldSocket::handle_input_header(void)
{ {
ACE_ASSERT (m_RecvWPct == nullptr); ASSERT(m_RecvWPct == nullptr);
ASSERT(m_Header.length() == sizeof(ClientPktHeader));
ACE_ASSERT (m_Header.length() == sizeof(ClientPktHeader));
if (m_Crypt.IsInitialized()) if (m_Crypt.IsInitialized())
m_Crypt.DecryptRecv((uint8*) m_Header.rd_ptr(), sizeof(ClientPktHeader)); m_Crypt.DecryptRecv((uint8*) m_Header.rd_ptr(), sizeof(ClientPktHeader));
@@ -495,7 +494,7 @@ int WorldSocket::handle_input_header(void)
} }
else else
{ {
ACE_ASSERT(m_RecvPct.space() == 0); ASSERT(m_RecvPct.space() == 0);
} }
return 0; return 0;
@@ -506,9 +505,9 @@ int WorldSocket::handle_input_payload(void)
// set errno properly here on error !!! // set errno properly here on error !!!
// now have a header and payload // now have a header and payload
ACE_ASSERT (m_RecvPct.space() == 0); ASSERT(m_RecvPct.space() == 0);
ACE_ASSERT (m_Header.space() == 0); ASSERT(m_Header.space() == 0);
ACE_ASSERT (m_RecvWPct != nullptr); ASSERT(m_RecvWPct != nullptr);
const int ret = ProcessIncoming (m_RecvWPct); const int ret = ProcessIncoming (m_RecvWPct);
@@ -562,7 +561,7 @@ int WorldSocket::handle_input_missing_data(void)
if (m_Header.space() > 0) if (m_Header.space() > 0)
{ {
// Couldn't receive the whole header this time. // Couldn't receive the whole header this time.
ACE_ASSERT (message_block.length() == 0); ASSERT(message_block.length() == 0);
errno = EWOULDBLOCK; errno = EWOULDBLOCK;
return -1; return -1;
} }
@@ -570,7 +569,7 @@ int WorldSocket::handle_input_missing_data(void)
// We just received nice new header // We just received nice new header
if (handle_input_header() == -1) if (handle_input_header() == -1)
{ {
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); ASSERT((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1; return -1;
} }
} }
@@ -596,7 +595,7 @@ int WorldSocket::handle_input_missing_data(void)
if (m_RecvPct.space() > 0) if (m_RecvPct.space() > 0)
{ {
// Couldn't receive the whole data this time. // Couldn't receive the whole data this time.
ACE_ASSERT (message_block.length() == 0); ASSERT(message_block.length() == 0);
errno = EWOULDBLOCK; errno = EWOULDBLOCK;
return -1; return -1;
} }
@@ -605,7 +604,7 @@ int WorldSocket::handle_input_missing_data(void)
//just received fresh new payload //just received fresh new payload
if (handle_input_payload() == -1) if (handle_input_payload() == -1)
{ {
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); ASSERT((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1; return -1;
} }
} }
@@ -654,7 +653,7 @@ int WorldSocket::schedule_wakeup_output(GuardType& g)
int WorldSocket::ProcessIncoming(WorldPacket* new_pct) int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
{ {
ACE_ASSERT (new_pct); ASSERT(new_pct);
// manage memory ;) // manage memory ;)
std::unique_ptr<WorldPacket> aptr (new_pct); std::unique_ptr<WorldPacket> aptr (new_pct);

View File

@@ -141,7 +141,7 @@ protected:
sLog->outStaticDebug ("Network Thread Starting"); sLog->outStaticDebug ("Network Thread Starting");
#endif #endif
ACE_ASSERT (m_Reactor); ASSERT(m_Reactor);
SocketSet::iterator i, t; SocketSet::iterator i, t;
@@ -344,7 +344,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
// we skip the Acceptor Thread // we skip the Acceptor Thread
size_t min = 1; size_t min = 1;
ACE_ASSERT (m_NetThreadsCount >= 1); ASSERT(m_NetThreadsCount >= 1);
for (size_t i = 1; i < m_NetThreadsCount; ++i) for (size_t i = 1; i < m_NetThreadsCount; ++i)
if (m_NetThreads[i].Connections() < m_NetThreads[min].Connections()) if (m_NetThreads[i].Connections() < m_NetThreads[min].Connections())

View File

@@ -10,8 +10,8 @@
#include "AccountMgr.h" #include "AccountMgr.h"
#include "Common.h" #include "Common.h"
#include "Configuration/Config.h" #include "Config.h"
#include "Database/DatabaseEnv.h" #include "DatabaseEnv.h"
#include "Duration.h" #include "Duration.h"
#include "Log.h" #include "Log.h"
#include "RASocket.h" #include "RASocket.h"
@@ -85,7 +85,7 @@ int RASocket::recv_line(ACE_Message_Block& buffer)
return -1; return -1;
} }
ACE_ASSERT(n == sizeof(byte)); ASSERT(n == sizeof(byte));
if (byte == '\n') if (byte == '\n')
break; break;