[tuxdroid-svn] r435 - daemon/trunk/libs
Status: Beta
Brought to you by:
ks156
From: neimad <c2m...@c2...> - 2007-06-24 12:52:29
|
Author: neimad Date: 2007-06-24 14:52:25 +0200 (Sun, 24 Jun 2007) New Revision: 435 Modified: daemon/trunk/libs/USBDaemon_tcp_server.c Log: * Don't compact the array of tcp client handles: there's no point in doing so, and it even may hinder debugging as a client id would then change over time (depending on its index in the array). Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:42:54 UTC (rev 434) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-06-24 12:52:25 UTC (rev 435) @@ -272,24 +272,18 @@ close(tcp_server_handle); } -/************************************************************************ */ - -/* Remove a tcp client */ - -/************************************************************************ */ +/** + * Remove a TCP client. + * + * The client's entry in the clients array is left empty (-1), so this + * array may contain holes. + * + * @param[in] id_client Id of client to remove + */ void tcp_remove_client(int id_client) { - int i, j; - int tmp_handle; - - tmp_handle = tcp_clients_handle[id_client]; + close(tcp_clients_handle[id_client]); tcp_clients_handle[id_client] = -1; + tcp_clients_count--; - close(tmp_handle); - for (i = id_client; i < TUX_MAX_TCP_CLIENTS - 1; i++) - { - tcp_clients_handle[i] = tcp_clients_handle[i + 1]; - for (j = 0; j < 16; j++) - tcp_clients_name[i][j] = tcp_clients_name[i + 1][j]; - } } |