Compare commits
No commits in common. "07eb5961803775a55f0d9cc0fa86e78c181a5876" and "b3924514861ab51f51117d93fd2e4e520f71f4ff" have entirely different histories.
07eb596180
...
b392451486
@ -46,7 +46,6 @@ typedef struct _connection_node
|
|||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
char *username;
|
char *username;
|
||||||
unsigned long id;
|
unsigned long id;
|
||||||
char *key; //EACH USER WILL USE DIFFERENT KEY FOR COMMUNICATION
|
|
||||||
} connection_node_t; //SINGLE LINKED LIST
|
} connection_node_t; //SINGLE LINKED LIST
|
||||||
|
|
||||||
why2_list_t connection_list = WHY2_LIST_EMPTY;
|
why2_list_t connection_list = WHY2_LIST_EMPTY;
|
||||||
@ -659,8 +658,7 @@ void *why2_communicate_thread(void *arg)
|
|||||||
connection,
|
connection,
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
why2_strdup(username),
|
why2_strdup(username),
|
||||||
get_latest_id(),
|
get_latest_id()
|
||||||
why2_generate_key(why2_get_key_length())
|
|
||||||
};
|
};
|
||||||
|
|
||||||
why2_list_push(&connection_list, &node, sizeof(node)); //ADD TO LIST
|
why2_list_push(&connection_list, &node, sizeof(node)); //ADD TO LIST
|
||||||
@ -858,7 +856,6 @@ void *why2_communicate_thread(void *arg)
|
|||||||
//DEALLOCATION
|
//DEALLOCATION
|
||||||
close(connection);
|
close(connection);
|
||||||
why2_deallocate(node.username);
|
why2_deallocate(node.username);
|
||||||
why2_deallocate(node.key);
|
|
||||||
|
|
||||||
why2_list_remove(&connection_list, find_connection(connection));
|
why2_list_remove(&connection_list, find_connection(connection));
|
||||||
|
|
||||||
@ -962,8 +959,6 @@ void *why2_listen_server(void *socket)
|
|||||||
|
|
||||||
if (server_uname == NULL) //GET SERVER USERNAME
|
if (server_uname == NULL) //GET SERVER USERNAME
|
||||||
{
|
{
|
||||||
if (code == NULL || strcmp(code, WHY2_CHAT_CODE_ACCEPT_MESSAGES) != 0) goto deallocation;
|
|
||||||
|
|
||||||
server_uname = why2_strdup(username); //GET USERNAME
|
server_uname = why2_strdup(username); //GET USERNAME
|
||||||
|
|
||||||
//GET INFO
|
//GET INFO
|
||||||
@ -1099,14 +1094,13 @@ void *why2_listen_server(void *socket)
|
|||||||
printf("\n\n%s%s: %s\n\n", WHY2_CLEAR_AND_GO_UP, username, message);
|
printf("\n\n%s%s: %s\n\n", WHY2_CLEAR_AND_GO_UP, username, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!exiting && !continuing)
|
if (!exiting && !continuing)
|
||||||
{
|
{
|
||||||
printf(">>> ");
|
printf(">>> ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
deallocation:
|
|
||||||
|
|
||||||
//DEALLOCATION
|
//DEALLOCATION
|
||||||
why2_deallocate(read);
|
why2_deallocate(read);
|
||||||
why2_deallocate(username);
|
why2_deallocate(username);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user