mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator
synced 2025-07-07 06:52:15 +08:00
Destroy client, network sockets and other objects on shutdown.
This commit is contained in:
@ -751,7 +751,6 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
||||
{
|
||||
tcp_port = udp_port = port;
|
||||
own_ip = 0x7F000001;
|
||||
alive = true;
|
||||
last_run = std::chrono::high_resolution_clock::now();
|
||||
this->appid = appid;
|
||||
|
||||
@ -843,6 +842,21 @@ Networking::Networking(CSteamID id, uint32 appid, uint16 port, std::set<IP_PORT>
|
||||
reset_last_error();
|
||||
}
|
||||
|
||||
Networking::~Networking()
|
||||
{
|
||||
for (auto &c : connections) {
|
||||
kill_tcp_socket(c.tcp_socket_incoming);
|
||||
kill_tcp_socket(c.tcp_socket_outgoing);
|
||||
}
|
||||
|
||||
for (auto &c : accepted) {
|
||||
kill_tcp_socket(c);
|
||||
}
|
||||
|
||||
kill_socket(udp_socket);
|
||||
kill_socket(tcp_socket);
|
||||
}
|
||||
|
||||
Common_Message Networking::create_announce(bool request)
|
||||
{
|
||||
Announce *announce = new Announce();
|
||||
@ -1265,13 +1279,3 @@ uint32 Networking::getOwnIP()
|
||||
{
|
||||
return own_ip;
|
||||
}
|
||||
|
||||
void Networking::shutDown()
|
||||
{
|
||||
alive = false;
|
||||
}
|
||||
|
||||
bool Networking::isAlive()
|
||||
{
|
||||
return alive;
|
||||
}
|
||||
|
Reference in New Issue
Block a user