void exec_cmd(t_users *u, t_task_info *ti) { if (u->first_message == false && u->type != TGRAPHICS && u->tasks->size < 10) add_task(u, ti); else if (u->first_message == false && u->type == TGRAPHICS) answer_graphics(u, ti); else { if (ti->args && ti->args[0]) { if (!strcmp(ti->args[0], GRAPHIC_USR)) { u->type = TGRAPHICS; greet_graphics(u); } else assign_client(u, ti->args); u->first_message = false; } ti->task_failure = true; } if (ti->task_failure) free_task_info(ti); }
int start_ftp_server(int server_sock, serv_conf * main_conf) { client * this_client; clients = NULL; clientcount = 0; build_handlers(); while (1) { this_client = assign_client(server_sock); if (this_client->sock == -1) { ERR("Client socket failed\n"); close(this_client->sock); } else { thread_client_handle(this_client); } } return 1; }