Common/ENetUtil: Move interface into Common namespace

Rather than just being under a separate ENetUtil namespace, we can unify
this into the common namespace as Common::ENet.
This commit is contained in:
Lioncash 2023-04-11 09:12:01 -04:00
parent af52b5a2d9
commit 64ce2012e3
4 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
namespace ENetUtil
namespace Common::ENet
{
void WakeupThread(ENetHost* host)
{
@ -62,4 +62,4 @@ bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id)
return true;
}
} // namespace ENetUtil
} // namespace Common::ENet

View File

@ -9,9 +9,9 @@
#include "Common/CommonTypes.h"
namespace ENetUtil
namespace Common::ENet
{
void WakeupThread(ENetHost* host);
int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id);
} // namespace ENetUtil
} // namespace Common::ENet

View File

@ -168,7 +168,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay
{
if (Connect())
{
m_client->intercept = ENetUtil::InterceptCallback;
m_client->intercept = Common::ENet::InterceptCallback;
m_thread = std::thread(&NetPlayClient::ThreadFunc, this);
}
}
@ -1522,7 +1522,7 @@ void NetPlayClient::OnGameDigestAbort()
void NetPlayClient::Send(const sf::Packet& packet, const u8 channel_id)
{
ENetUtil::SendPacket(m_server, packet, channel_id);
Common::ENet::SendPacket(m_server, packet, channel_id);
}
void NetPlayClient::DisplayPlayersPing()
@ -1577,7 +1577,7 @@ void NetPlayClient::SendAsync(sf::Packet&& packet, const u8 channel_id)
std::lock_guard lkq(m_crit.async_queue_write);
m_async_queue.Push(AsyncQueueEntry{std::move(packet), channel_id});
}
ENetUtil::WakeupThread(m_client);
Common::ENet::WakeupThread(m_client);
}
// called from ---NETPLAY--- thread

View File

@ -153,7 +153,7 @@ NetPlayServer::NetPlayServer(const u16 port, const bool forward_port, NetPlayUI*
if (m_server != nullptr)
{
m_server->mtu = std::min(m_server->mtu, NetPlay::MAX_ENET_MTU);
m_server->intercept = ENetUtil::InterceptCallback;
m_server->intercept = Common::ENet::InterceptCallback;
}
SetupIndex();
@ -701,7 +701,7 @@ void NetPlayServer::SendAsync(sf::Packet&& packet, const PlayerId pid, const u8
std::lock_guard lkq(m_crit.async_queue_write);
m_async_queue.Push(AsyncQueueEntry{std::move(packet), pid, TargetMode::Only, channel_id});
}
ENetUtil::WakeupThread(m_server);
Common::ENet::WakeupThread(m_server);
}
void NetPlayServer::SendAsyncToClients(sf::Packet&& packet, const PlayerId skip_pid,
@ -712,7 +712,7 @@ void NetPlayServer::SendAsyncToClients(sf::Packet&& packet, const PlayerId skip_
m_async_queue.Push(
AsyncQueueEntry{std::move(packet), skip_pid, TargetMode::AllExcept, channel_id});
}
ENetUtil::WakeupThread(m_server);
Common::ENet::WakeupThread(m_server);
}
void NetPlayServer::SendChunked(sf::Packet&& packet, const PlayerId pid, const std::string& title)
@ -2183,7 +2183,7 @@ void NetPlayServer::SendToClients(const sf::Packet& packet, const PlayerId skip_
void NetPlayServer::Send(ENetPeer* socket, const sf::Packet& packet, const u8 channel_id)
{
ENetUtil::SendPacket(socket, packet, channel_id);
Common::ENet::SendPacket(socket, packet, channel_id);
}
void NetPlayServer::KickPlayer(PlayerId player)