int init_server_container(AppServerContainer** container_ptr){ *container_ptr = (AppServerContainer*)malloc(sizeof(AppServerContainer)); (*container_ptr)->last_served_index = 3; init_server_struct(&((*container_ptr)->servers[0]), S2ELAB_IP); init_server_struct(&((*container_ptr)->servers[1]), S2ELABSTUDENT_IP); init_server_struct(&((*container_ptr)->servers[2]), S2ELABTEACHER_IP); init_server_struct(&((*container_ptr)->servers[3]), S2ELABTUTOR_IP); return 0; }
int init_server_container(AppServerContainer** container_ptr){ *container_ptr = (AppServerContainer*)malloc(sizeof(AppServerContainer)); (*container_ptr)->now_serving[0]=0; (*container_ptr)->now_serving[1]=0; (*container_ptr)->now_serving[2]=0; (*container_ptr)->now_serving[3]=0; init_server_struct(&((*container_ptr)->servers[0]), S2ELAB_IP); init_server_struct(&((*container_ptr)->servers[1]), S2ELABSTUDENT_IP); init_server_struct(&((*container_ptr)->servers[2]), S2ELABTEACHER_IP); init_server_struct(&((*container_ptr)->servers[3]), S2ELABTUTOR_IP); return 0; }
int init_server_container(AppServerContainer** container_ptr){ *container_ptr = (AppServerContainer*)malloc(sizeof(AppServerContainer)); (*container_ptr)->weight[0]=100; (*container_ptr)->weight[1]=200; (*container_ptr)->weight[2]=300; (*container_ptr)->weight[3]=400; (*container_ptr)->time[0]=100; (*container_ptr)->time[1]=100; (*container_ptr)->time[2]=100; (*container_ptr)->time[3]=100; init_server_struct(&((*container_ptr)->servers[0]), S2ELAB_IP); init_server_struct(&((*container_ptr)->servers[1]), S2ELABSTUDENT_IP); init_server_struct(&((*container_ptr)->servers[2]), S2ELABTEACHER_IP); init_server_struct(&((*container_ptr)->servers[3]), S2ELABTUTOR_IP); return 0; }
bool start_server(t_server *server) { int size[2]; size[0] = server->args->x; size[1] = server->args->y; signal_handler(); if (init_server_struct(server) == false) return (false); if (init_server(server) == false) return (false); init_map(&server->map, size); server->fd_type[server->socket] = FD_SERVER; server->exec[server->socket] = &add_client; spawn_res(&server->map); if (handler_connection(server) == false) return (false); return (true); }