optimalyzed send_to_all loop

This commit is contained in:
Václav Šmejkal 2023-04-20 09:49:16 +02:00
parent 41291fd345
commit 1af6cf45a1
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59

View File

@ -71,6 +71,8 @@ void *send_to_all(void *json)
//PARSE //PARSE
struct json_object *json_obj = json_tokener_parse((char*) json); struct json_object *json_obj = json_tokener_parse((char*) json);
char *message = get_string_from_json(json_obj, "message");
char *username = get_string_from_json(json_obj, "username");
if (json_obj == NULL) return NULL; //EXIT IF INVALID SYNTAX WAS SENT if (json_obj == NULL) return NULL; //EXIT IF INVALID SYNTAX WAS SENT
@ -80,7 +82,7 @@ void *send_to_all(void *json)
connection_buffer = *(connection_node_t*) node_buffer -> value; connection_buffer = *(connection_node_t*) node_buffer -> value;
why2_send_socket(get_string_from_json(json_obj, "message"), get_string_from_json(json_obj, "username"), connection_buffer.connection); //SEND TO CLIENT why2_send_socket(message, username, connection_buffer.connection); //SEND TO CLIENT
} }
//DEALLOCATION //DEALLOCATION