Close sockets

This commit is contained in:
ChillerDrgon 2022-04-14 11:50:10 +02:00
parent 0157deae61
commit 18ca71ae55
4 changed files with 12 additions and 4 deletions

View file

@ -3271,6 +3271,10 @@ void CClient::Run()
GameClient()->OnShutdown();
Disconnect();
// close socket
for(unsigned int i = 0; i < std::size(m_NetClient); i++)
m_NetClient[i].Close();
delete m_pEditor;
m_pGraphics->Shutdown();

View file

@ -2747,6 +2747,8 @@ int CServer::Run()
free(Client.m_pPersistentData);
}
m_NetServer.Close();
return ErrorShutdown();
}

View file

@ -23,8 +23,9 @@ bool CNetClient::Open(NETADDR BindAddr)
int CNetClient::Close()
{
// TODO: implement me
return 0;
if(!m_Socket)
return 0;
return net_udp_close(m_Socket);
}
int CNetClient::Disconnect(const char *pReason)

View file

@ -96,8 +96,9 @@ int CNetServer::SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_NEWCLIENT_N
int CNetServer::Close()
{
// TODO: implement me
return 0;
if(!m_Socket)
return 0;
return net_udp_close(m_Socket);
}
int CNetServer::Drop(int ClientID, const char *pReason)