mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
BBA/HLE: Fix network_ref coding style
This commit is contained in:
@ -88,7 +88,7 @@ bool CEXIETHERNET::BuiltInBBAInterface::Activate()
|
|||||||
m_router_mac = Common::GenerateMacAddress(Common::MACConsumer::BBA);
|
m_router_mac = Common::GenerateMacAddress(Common::MACConsumer::BBA);
|
||||||
m_arp_table[m_router_ip] = m_router_mac;
|
m_arp_table[m_router_ip] = m_router_mac;
|
||||||
|
|
||||||
network_ref.Clear();
|
m_network_ref.Clear();
|
||||||
|
|
||||||
m_upnp_httpd.listen(Common::SSDP_PORT, sf::IpAddress(ip));
|
m_upnp_httpd.listen(Common::SSDP_PORT, sf::IpAddress(ip));
|
||||||
m_upnp_httpd.setBlocking(false);
|
m_upnp_httpd.setBlocking(false);
|
||||||
@ -106,7 +106,7 @@ void CEXIETHERNET::BuiltInBBAInterface::Deactivate()
|
|||||||
m_read_thread_shutdown.Set();
|
m_read_thread_shutdown.Set();
|
||||||
m_active = false;
|
m_active = false;
|
||||||
|
|
||||||
network_ref.Clear();
|
m_network_ref.Clear();
|
||||||
m_arp_table.clear();
|
m_arp_table.clear();
|
||||||
m_upnp_httpd.close();
|
m_upnp_httpd.close();
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ void CEXIETHERNET::BuiltInBBAInterface::WriteToQueue(const std::vector<u8>& data
|
|||||||
|
|
||||||
void CEXIETHERNET::BuiltInBBAInterface::PollData(std::size_t* datasize)
|
void CEXIETHERNET::BuiltInBBAInterface::PollData(std::size_t* datasize)
|
||||||
{
|
{
|
||||||
for (auto& net_ref : network_ref)
|
for (auto& net_ref : m_network_ref)
|
||||||
{
|
{
|
||||||
if (net_ref.ip == 0)
|
if (net_ref.ip == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -302,8 +302,8 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleTCPFrame(const Common::TCPPacket&
|
|||||||
{
|
{
|
||||||
const auto& [hwdata, ip_header, tcp_header, ip_options, tcp_options, data] = packet;
|
const auto& [hwdata, ip_header, tcp_header, ip_options, tcp_options, data] = packet;
|
||||||
sf::IpAddress target;
|
sf::IpAddress target;
|
||||||
StackRef* ref = network_ref.GetTCPSlot(tcp_header.source_port, tcp_header.destination_port,
|
StackRef* ref = m_network_ref.GetTCPSlot(tcp_header.source_port, tcp_header.destination_port,
|
||||||
Common::BitCast<u32>(ip_header.destination_addr));
|
Common::BitCast<u32>(ip_header.destination_addr));
|
||||||
const u16 flags = ntohs(tcp_header.properties) & 0xfff;
|
const u16 flags = ntohs(tcp_header.properties) & 0xfff;
|
||||||
if (flags & (TCP_FLAG_FIN | TCP_FLAG_RST))
|
if (flags & (TCP_FLAG_FIN | TCP_FLAG_RST))
|
||||||
{
|
{
|
||||||
@ -332,7 +332,7 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleTCPFrame(const Common::TCPPacket&
|
|||||||
// new connection
|
// new connection
|
||||||
if (ref != nullptr)
|
if (ref != nullptr)
|
||||||
return;
|
return;
|
||||||
ref = network_ref.GetAvailableSlot(0);
|
ref = m_network_ref.GetAvailableSlot(0);
|
||||||
|
|
||||||
ref->delay = GetTickCountStd();
|
ref->delay = GetTickCountStd();
|
||||||
ref->local = tcp_header.source_port;
|
ref->local = tcp_header.source_port;
|
||||||
@ -422,7 +422,7 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleTCPFrame(const Common::TCPPacket&
|
|||||||
// and listen to it. We open it on our side manually.
|
// and listen to it. We open it on our side manually.
|
||||||
void CEXIETHERNET::BuiltInBBAInterface::InitUDPPort(u16 port)
|
void CEXIETHERNET::BuiltInBBAInterface::InitUDPPort(u16 port)
|
||||||
{
|
{
|
||||||
StackRef* ref = network_ref.GetAvailableSlot(htons(port));
|
StackRef* ref = m_network_ref.GetAvailableSlot(htons(port));
|
||||||
if (ref == nullptr || ref->ip != 0)
|
if (ref == nullptr || ref->ip != 0)
|
||||||
return;
|
return;
|
||||||
ref->ip = m_router_ip; // change for ip
|
ref->ip = m_router_ip; // change for ip
|
||||||
@ -452,7 +452,7 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleUDPFrame(const Common::UDPPacket&
|
|||||||
m_router_ip : // dns request
|
m_router_ip : // dns request
|
||||||
Common::BitCast<u32>(ip_header.destination_addr);
|
Common::BitCast<u32>(ip_header.destination_addr);
|
||||||
|
|
||||||
StackRef* ref = network_ref.GetAvailableSlot(udp_header.source_port);
|
StackRef* ref = m_network_ref.GetAvailableSlot(udp_header.source_port);
|
||||||
if (ref->ip == 0)
|
if (ref->ip == 0)
|
||||||
{
|
{
|
||||||
ref->ip = destination_addr; // change for ip
|
ref->ip = destination_addr; // change for ip
|
||||||
@ -497,7 +497,7 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleUDPFrame(const Common::UDPPacket&
|
|||||||
|
|
||||||
void CEXIETHERNET::BuiltInBBAInterface::HandleUPnPClient()
|
void CEXIETHERNET::BuiltInBBAInterface::HandleUPnPClient()
|
||||||
{
|
{
|
||||||
StackRef* ref = network_ref.GetAvailableSlot(0);
|
StackRef* ref = m_network_ref.GetAvailableSlot(0);
|
||||||
if (ref == nullptr || m_upnp_httpd.accept(ref->tcp_socket) != sf::Socket::Done)
|
if (ref == nullptr || m_upnp_httpd.accept(ref->tcp_socket) != sf::Socket::Done)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ void CEXIETHERNET::BuiltInBBAInterface::RecvStart()
|
|||||||
void CEXIETHERNET::BuiltInBBAInterface::RecvStop()
|
void CEXIETHERNET::BuiltInBBAInterface::RecvStop()
|
||||||
{
|
{
|
||||||
m_read_enabled.Clear();
|
m_read_enabled.Clear();
|
||||||
network_ref.Clear();
|
m_network_ref.Clear();
|
||||||
m_queue_read = 0;
|
m_queue_read = 0;
|
||||||
m_queue_write = 0;
|
m_queue_write = 0;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ private:
|
|||||||
sf::TcpListener m_upnp_httpd;
|
sf::TcpListener m_upnp_httpd;
|
||||||
#if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
|
#if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
|
||||||
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||||
NetworkRef network_ref;
|
NetworkRef m_network_ref;
|
||||||
std::thread m_read_thread;
|
std::thread m_read_thread;
|
||||||
Common::Flag m_read_enabled;
|
Common::Flag m_read_enabled;
|
||||||
Common::Flag m_read_thread_shutdown;
|
Common::Flag m_read_thread_shutdown;
|
||||||
|
Reference in New Issue
Block a user