Example #1
0
/*
 * This is used to drop a client when it is detected that the connection to it
 * has been lost.
 */
void
GsDropClient(int fd)
{
	GR_CLIENT *client;

	if((client = GsFindClient(fd))) { /* If it exists */
		close(fd);	/* Close the socket */

		GsDestroyClientResources(client);
		if(client == root_client)
			root_client = client->next;
		/* Link the prev to the next */
		if(client->prev) client->prev->next = client->next;

		/* Link the next to the prev */
		if(client->next) client->next->prev = client->prev;

#if HAVE_SHAREDMEM_SUPPORT
		if ( client->shm_cmds != 0 ) {
			/* Free shared memory */
			shmctl(client->shm_cmds_shmid,IPC_RMID,0);
			shmdt(client->shm_cmds);
		}
#endif
GsPrintResources();
		free(client);	/* Free the structure */

		clipwp = NULL;	/* reset clip window*/
		--connectcount;
	} else EPRINTF("nano-X: trying to drop non-existent client %d.\n", fd);
}
Example #2
0
void
GsDropClient(int fd)
{
	GR_CLIENT *client;
	extern GR_CLIENT *root_client;

	client = curclient;
	if (! client) {
		EPRINTF("nano-X: trying to drop non-existent client %d.\n", fd);
		return;
	}
	GsDestroyClientResources (client);

	if (client == root_client)
		root_client = client->next;
	if (client->prev)
		client->prev->next = client->next;
	if (client->next)
		client->next->prev = client->prev;

	free (client);	/* Free the structure */
	curclient = 0;

	clipwp = NULL;	/* reset clip window */
	--connectcount;
}