Skip to content

Commit

Permalink
feat(Core/Sockets): replace ACE_ASSERT to default core ASSERT (#4950)
Browse files Browse the repository at this point in the history
  • Loading branch information
Winfidonarleyan authored Mar 25, 2021
1 parent fb5d2fa commit 10fa49f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
27 changes: 13 additions & 14 deletions src/server/game/Server/WorldSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
{
// Put the packet on the buffer.
if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1)
ACE_ASSERT (false);
ABORT();

if (!pct.empty())
if (m_OutBuffer->copy((char*) pct.contents(), pct.size()) == -1)
ACE_ASSERT (false);
ABORT();
}
else
{
Expand Down Expand Up @@ -463,9 +463,8 @@ int WorldSocket::Update(void)

int WorldSocket::handle_input_header(void)
{
ACE_ASSERT (m_RecvWPct == nullptr);

ACE_ASSERT (m_Header.length() == sizeof(ClientPktHeader));
ASSERT(m_RecvWPct == nullptr);
ASSERT(m_Header.length() == sizeof(ClientPktHeader));

if (m_Crypt.IsInitialized())
m_Crypt.DecryptRecv((uint8*) m_Header.rd_ptr(), sizeof(ClientPktHeader));
Expand Down Expand Up @@ -495,7 +494,7 @@ int WorldSocket::handle_input_header(void)
}
else
{
ACE_ASSERT(m_RecvPct.space() == 0);
ASSERT(m_RecvPct.space() == 0);
}

return 0;
Expand All @@ -506,9 +505,9 @@ int WorldSocket::handle_input_payload(void)
// set errno properly here on error !!!
// now have a header and payload

ACE_ASSERT (m_RecvPct.space() == 0);
ACE_ASSERT (m_Header.space() == 0);
ACE_ASSERT (m_RecvWPct != nullptr);
ASSERT(m_RecvPct.space() == 0);
ASSERT(m_Header.space() == 0);
ASSERT(m_RecvWPct != nullptr);

const int ret = ProcessIncoming (m_RecvWPct);

Expand Down Expand Up @@ -562,15 +561,15 @@ int WorldSocket::handle_input_missing_data(void)
if (m_Header.space() > 0)
{
// Couldn't receive the whole header this time.
ACE_ASSERT (message_block.length() == 0);
ASSERT(message_block.length() == 0);
errno = EWOULDBLOCK;
return -1;
}

// We just received nice new header
if (handle_input_header() == -1)
{
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
ASSERT((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1;
}
}
Expand All @@ -596,7 +595,7 @@ int WorldSocket::handle_input_missing_data(void)
if (m_RecvPct.space() > 0)
{
// Couldn't receive the whole data this time.
ACE_ASSERT (message_block.length() == 0);
ASSERT(message_block.length() == 0);
errno = EWOULDBLOCK;
return -1;
}
Expand All @@ -605,7 +604,7 @@ int WorldSocket::handle_input_missing_data(void)
//just received fresh new payload
if (handle_input_payload() == -1)
{
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
ASSERT((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1;
}
}
Expand Down Expand Up @@ -654,7 +653,7 @@ int WorldSocket::schedule_wakeup_output(GuardType& g)

int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
{
ACE_ASSERT (new_pct);
ASSERT(new_pct);

// manage memory ;)
std::unique_ptr<WorldPacket> aptr (new_pct);
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Server/WorldSocketMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class ReactorRunnable : protected ACE_Task_Base
sLog->outStaticDebug ("Network Thread Starting");
#endif

ACE_ASSERT (m_Reactor);
ASSERT(m_Reactor);

SocketSet::iterator i, t;

Expand Down Expand Up @@ -344,7 +344,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
// we skip the Acceptor Thread
size_t min = 1;

ACE_ASSERT (m_NetThreadsCount >= 1);
ASSERT(m_NetThreadsCount >= 1);

for (size_t i = 1; i < m_NetThreadsCount; ++i)
if (m_NetThreads[i].Connections() < m_NetThreads[min].Connections())
Expand Down
6 changes: 3 additions & 3 deletions src/server/worldserver/RemoteAccess/RASocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "AccountMgr.h"
#include "Common.h"
#include "Configuration/Config.h"
#include "Database/DatabaseEnv.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "Duration.h"
#include "Log.h"
#include "RASocket.h"
Expand Down Expand Up @@ -85,7 +85,7 @@ int RASocket::recv_line(ACE_Message_Block& buffer)
return -1;
}

ACE_ASSERT(n == sizeof(byte));
ASSERT(n == sizeof(byte));

if (byte == '\n')
break;
Expand Down

0 comments on commit 10fa49f

Please sign in to comment.