From 7377b672bf26eeda4f4490933beb75ac79438d62 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 1 Feb 2025 18:07:13 +0100 Subject: [PATCH] returing code from why2_listen_authority --- src/chat/misc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index ba44609..884163c 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -1229,8 +1229,11 @@ void *why2_listen_authority(void *socket) int socket_ptr = *(int*) socket; char *read; why2_bool exiting = 0; + why2_bool *success = why2_malloc(sizeof(why2_bool)); char *code; + *success = 0; + do { //READ PACKET @@ -1286,15 +1289,20 @@ void *why2_listen_authority(void *socket) { why2_toml_read_free(username); } - } else exiting = 1; - } else exiting = 1; + } else + { + //EXIT + *success = strcmp(code, WHY2_CHAT_CODE_SUCCESS) == 0; + exiting = 1; + } + } //DEALLOCATION why2_deallocate(read); why2_deallocate(code); } while (!exiting); - return NULL; + return success; } void *why2_getline_thread(WHY2_UNUSED void* arg)