+/*
+ * Deletes client at index and disconnects the connection handle if it was
+ * set.
+ */
+static void remove_client( int index ){
+ struct gameserver_client *client = &gameserver.clients[index];
+ if( client->connection ){
+ SteamAPI_ISteamNetworkingSockets_SetConnectionUserData(
+ hSteamNetworkingSockets, client->connection, -1 );
+ SteamAPI_ISteamNetworkingSockets_CloseConnection(
+ hSteamNetworkingSockets, client->connection,
+ k_ESteamNetConnectionEnd_Misc_InternalError,
+ NULL, 1 );
+ }
+ memset( client, 0, sizeof(struct gameserver_client) );
+}
+
+/*
+ * Handle incoming new connection and init flags on the steam handle. if the
+ * server is full the userdata (client_id) will be set to -1 on the handle.
+ */
+static void handle_new_connection( HSteamNetConnection conn ){
+ SteamAPI_ISteamNetworkingSockets_SetConnectionUserData(
+ hSteamNetworkingSockets, conn, -1 );
+