BBA/HLE: Add NetworkRef::Clear method
This commit is contained in:
parent
e915f990bb
commit
5388f35cc4
|
@ -91,11 +91,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;
|
||||||
|
|
||||||
// clear all ref
|
network_ref.Clear();
|
||||||
for (auto& ref : network_ref)
|
|
||||||
{
|
|
||||||
ref.ip = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
|
@ -113,16 +109,7 @@ void CEXIETHERNET::BuiltInBBAInterface::Deactivate()
|
||||||
m_read_thread_shutdown.Set();
|
m_read_thread_shutdown.Set();
|
||||||
m_active = false;
|
m_active = false;
|
||||||
|
|
||||||
// kill all active socket
|
network_ref.Clear();
|
||||||
for (auto& ref : network_ref)
|
|
||||||
{
|
|
||||||
if (ref.ip != 0)
|
|
||||||
{
|
|
||||||
ref.type == IPPROTO_TCP ? ref.tcp_socket.disconnect() : ref.udp_socket.unbind();
|
|
||||||
}
|
|
||||||
ref.ip = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_arp_table.clear();
|
m_arp_table.clear();
|
||||||
m_upnp_httpd.close();
|
m_upnp_httpd.close();
|
||||||
|
|
||||||
|
@ -778,14 +765,7 @@ void CEXIETHERNET::BuiltInBBAInterface::RecvStart()
|
||||||
void CEXIETHERNET::BuiltInBBAInterface::RecvStop()
|
void CEXIETHERNET::BuiltInBBAInterface::RecvStop()
|
||||||
{
|
{
|
||||||
m_read_enabled.Clear();
|
m_read_enabled.Clear();
|
||||||
for (auto& net_ref : network_ref)
|
network_ref.Clear();
|
||||||
{
|
|
||||||
if (net_ref.ip != 0)
|
|
||||||
{
|
|
||||||
net_ref.type == IPPROTO_TCP ? net_ref.tcp_socket.disconnect() : net_ref.udp_socket.unbind();
|
|
||||||
}
|
|
||||||
net_ref.ip = 0;
|
|
||||||
}
|
|
||||||
m_queue_read = 0;
|
m_queue_read = 0;
|
||||||
m_queue_write = 0;
|
m_queue_write = 0;
|
||||||
}
|
}
|
||||||
|
@ -986,3 +966,15 @@ sf::Socket::Status BbaUdpSocket::Bind(u16 port, u32 net_ip)
|
||||||
INFO_LOG_FMT(SP1, "SSDP multicast membership successful");
|
INFO_LOG_FMT(SP1, "SSDP multicast membership successful");
|
||||||
return sf::Socket::Status::Done;
|
return sf::Socket::Status::Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkRef::Clear()
|
||||||
|
{
|
||||||
|
for (auto& ref : m_stacks)
|
||||||
|
{
|
||||||
|
if (ref.ip != 0)
|
||||||
|
{
|
||||||
|
ref.type == IPPROTO_TCP ? ref.tcp_socket.disconnect() : ref.udp_socket.unbind();
|
||||||
|
}
|
||||||
|
ref.ip = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
|
|
||||||
struct StackRef
|
struct StackRef
|
||||||
{
|
{
|
||||||
u32 ip;
|
u32 ip = 0;
|
||||||
u16 local;
|
u16 local;
|
||||||
u16 remote;
|
u16 remote;
|
||||||
u16 type;
|
u16 type;
|
||||||
|
@ -107,6 +107,8 @@ public:
|
||||||
auto end() { return m_stacks.end(); }
|
auto end() { return m_stacks.end(); }
|
||||||
auto end() const { return m_stacks.cend(); }
|
auto end() const { return m_stacks.cend(); }
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StackRefs m_stacks;
|
StackRefs m_stacks;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue