Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 3 additions & 2 deletions src/server/game/Server/WorldSocketMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Common.h"
#include "Config.h"
#include "DatabaseEnv.h"
// #include "Errors.h"
Winfidonarleyan marked this conversation as resolved.
Show resolved Hide resolved
#include "Log.h"
#include "ScriptMgr.h"
#include "WorldSocket.h"
Expand Down Expand Up @@ -141,7 +142,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 +345,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