|
@@ -432,25 +432,25 @@ static NetworkClientSocket *NetworkAlloc
|
|
|
NetworkClientSocket *cs = new NetworkClientSocket(INVALID_CLIENT_ID);
|
|
|
cs->sock = s;
|
|
|
cs->last_frame = _frame_counter;
|
|
|
cs->last_frame_server = _frame_counter;
|
|
|
|
|
|
if (_network_server) {
|
|
|
cs->client_id = _network_client_id++;
|
|
|
NetworkClientInfo *ci = new NetworkClientInfo(cs->client_id);
|
|
|
cs->SetInfo(ci);
|
|
|
ci->client_playas = COMPANY_INACTIVE_CLIENT;
|
|
|
ci->join_date = _date;
|
|
|
|
|
|
InvalidateWindow(WC_CLIENT_LIST, 0);
|
|
|
SetWindowDirty(WC_CLIENT_LIST, 0);
|
|
|
}
|
|
|
|
|
|
return cs;
|
|
|
}
|
|
|
|
|
|
/* Close a connection */
|
|
|
void NetworkCloseClient(NetworkClientSocket *cs, bool error)
|
|
|
{
|
|
|
/*
|
|
|
* Sending a message just before leaving the game calls cs->Send_Packets.
|
|
|
* This might invoke this function, which means that when we close the
|
|
|
* connection after cs->Send_Packets we will close an already closed
|
|
@@ -480,25 +480,25 @@ void NetworkCloseClient(NetworkClientSoc
|
|
|
|
|
|
/* When the client was PRE_ACTIVE, the server was in pause mode, so unpause */
|
|
|
if (cs->status == STATUS_PRE_ACTIVE && (_pause_mode & PM_PAUSED_JOIN)) {
|
|
|
DoCommandP(0, PM_PAUSED_JOIN, 0, CMD_PAUSE);
|
|
|
NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "", CLIENT_ID_SERVER, NETWORK_SERVER_MESSAGE_GAME_UNPAUSED_CONNECT_FAIL);
|
|
|
}
|
|
|
|
|
|
if (_network_server) {
|
|
|
/* We just lost one client :( */
|
|
|
if (cs->status >= STATUS_AUTH) _network_game_info.clients_on--;
|
|
|
_network_clients_connected--;
|
|
|
|
|
|
InvalidateWindow(WC_CLIENT_LIST, 0);
|
|
|
SetWindowDirty(WC_CLIENT_LIST, 0);
|
|
|
}
|
|
|
|
|
|
delete cs->GetInfo();
|
|
|
delete cs;
|
|
|
}
|
|
|
|
|
|
/* For the server, to accept new clients */
|
|
|
static void NetworkAcceptClients(SOCKET ls)
|
|
|
{
|
|
|
for (;;) {
|
|
|
struct sockaddr_storage sin;
|
|
|
memset(&sin, 0, sizeof(sin));
|