From c47c9ffece74f71b08cc2374b80e5a34d633b1d6 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Tue, 21 Feb 2023 18:59:44 +0100 Subject: [PATCH] moved registering connection to new thread --- src/chat/main/server.c | 1 - src/chat/misc.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chat/main/server.c b/src/chat/main/server.c index ddfc491..cc89441 100644 --- a/src/chat/main/server.c +++ b/src/chat/main/server.c @@ -50,7 +50,6 @@ int main(void) if (accepted == -1) continue; pthread_create(&thread, NULL, why2_communicate_thread, &accepted); - why2_register_connection(accepted); //PUSH TO LIST } return 0; diff --git a/src/chat/misc.c b/src/chat/misc.c index 6d257b0..89a0a77 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -133,6 +133,8 @@ void *why2_communicate_thread(void *arg) { printf("User connected.\t%d\n", *((int*) arg)); + why2_register_connection(*((int*) arg)); //TODO: Remove why2_register_connection if unused + const time_t startTime = time(NULL); char *received = NULL;