Codechange: [Network] split CloseSocket and CloseConnection more clearly (#9261)
* Codechange: [Network] split CloseSocket and CloseConnection more clearly - CloseSocket now closes the actual OS socket. - CloseConnection frees up the resources to just before CloseSocket. - dtors call CloseSocket / CloseConnection where needed.
This commit is contained in:
@@ -44,7 +44,7 @@ NetworkUDPSocketHandler::NetworkUDPSocketHandler(NetworkAddressList *bind)
|
||||
bool NetworkUDPSocketHandler::Listen()
|
||||
{
|
||||
/* Make sure socket is closed */
|
||||
this->Close();
|
||||
this->CloseSocket();
|
||||
|
||||
for (NetworkAddress &addr : this->bind) {
|
||||
addr.Listen(SOCK_DGRAM, &this->sockets);
|
||||
@@ -54,9 +54,9 @@ bool NetworkUDPSocketHandler::Listen()
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the given UDP socket
|
||||
* Close the actual UDP socket.
|
||||
*/
|
||||
void NetworkUDPSocketHandler::Close()
|
||||
void NetworkUDPSocketHandler::CloseSocket()
|
||||
{
|
||||
for (auto &s : this->sockets) {
|
||||
closesocket(s.second);
|
||||
@@ -64,12 +64,6 @@ void NetworkUDPSocketHandler::Close()
|
||||
this->sockets.clear();
|
||||
}
|
||||
|
||||
NetworkRecvStatus NetworkUDPSocketHandler::CloseConnection(bool error)
|
||||
{
|
||||
NetworkSocketHandler::CloseConnection(error);
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a packet over UDP
|
||||
* @param p the packet to send
|
||||
|
||||
Reference in New Issue
Block a user