static void NET_SV_DisconnectClient(net_client_t *client) { if (client->active) { NET_Conn_Disconnect(&client->connection); } }
void NET_CL_Disconnect(void) { int start_time; if (!net_client_connected) { return; } NET_Conn_Disconnect(&client_connection); start_time = I_GetTimeMS(); while (client_connection.state != NET_CONN_STATE_DISCONNECTED && client_connection.state != NET_CONN_STATE_DISCONNECTED_SLEEP) { if (I_GetTimeMS() - start_time > 5000) { // time out after 5 seconds client_state = NET_CONN_STATE_DISCONNECTED; fprintf(stderr, "NET_CL_Disconnect: Timeout while disconnecting from server\n"); break; } NET_CL_Run(); NET_SV_Run(); I_Sleep(1); } // Finished sending disconnect packets, etc. NET_CL_Shutdown(); }