Small bug fix, close socket

This commit is contained in:
simon.kagstrom 2009-01-29 20:35:06 +00:00
parent 978f0ce537
commit 1fc28d9bbf
3 changed files with 9 additions and 1 deletions

View File

@ -614,7 +614,7 @@ void NetworkServer::RemoveClient(NetworkClient *client)
/* Swap with last */
this->clients[i] = this->clients[this->n_clients - 1];
}
delete this->clients[i];
delete client;
this->n_clients--;
return;
}
@ -636,6 +636,7 @@ NetworkClient::NetworkClient(int sock) : Network()
NetworkClient::~NetworkClient()
{
free(this->screen);
this->CloseSocket(this->sock);
}
void NetworkClient::Disconnect()

View File

@ -67,6 +67,8 @@ public:
this->bytes_sent = 0;
}
void CloseSocket(int sock);
bool SendUpdate(int sock);
bool ReceiveUpdate(int sock);

View File

@ -200,3 +200,8 @@ bool Network::Select(int sock, struct timeval *tv)
/* v is 0 if the sock is not ready */
return v > 0;
}
void Network::CloseSocket(int sock)
{
close(sock);
}