implemented communication_time from server config
This commit is contained in:
parent
8c742b1884
commit
968498cf4e
@ -27,7 +27,6 @@ extern "C" {
|
|||||||
#define WHY2_SA struct sockaddr
|
#define WHY2_SA struct sockaddr
|
||||||
#define WHY2_CHAT_SERVER_PORT 1204 //PORT
|
#define WHY2_CHAT_SERVER_PORT 1204 //PORT
|
||||||
#define WHY2_MAX_CONNECTIONS 1000 //MAX USERS CONNECTED AT ONE TIME
|
#define WHY2_MAX_CONNECTIONS 1000 //MAX USERS CONNECTED AT ONE TIME
|
||||||
#define WHY2_COMMUNICATION_TIME 300 //SECONDS WAITING BEFORE KICKING USER (TIMEOUT)
|
|
||||||
|
|
||||||
#define WHY2_CLEAR_AND_GO_UP "\33[2K\r\033[A" //i mean read the name
|
#define WHY2_CLEAR_AND_GO_UP "\33[2K\r\033[A" //i mean read the name
|
||||||
|
|
||||||
|
@ -225,7 +225,13 @@ why2_bool check_username(char *username)
|
|||||||
|
|
||||||
void *stop_oldest_thread(void *id)
|
void *stop_oldest_thread(void *id)
|
||||||
{
|
{
|
||||||
sleep(WHY2_COMMUNICATION_TIME); //yk wait
|
//GET THE communication_time INTEGER
|
||||||
|
char *communication_time_str = why2_chat_server_config("communication_time");
|
||||||
|
int communication_time = atoi(communication_time_str);
|
||||||
|
why2_toml_read_free(communication_time_str);
|
||||||
|
|
||||||
|
sleep(communication_time); //yk wait
|
||||||
|
|
||||||
if (waiting_list.head == NULL) return NULL;
|
if (waiting_list.head == NULL) return NULL;
|
||||||
if (**(pthread_t**) waiting_list.head -> value == *(pthread_t*) id) //THREAD IS STILL ALIVE, I HOPE
|
if (**(pthread_t**) waiting_list.head -> value == *(pthread_t*) id) //THREAD IS STILL ALIVE, I HOPE
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user