aboutsummaryrefslogtreecommitdiff
path: root/chat_request.h
diff options
context:
space:
mode:
authorBen Burwell <bburwell1@gmail.com>2013-05-01 15:39:02 -0400
committerBen Burwell <bburwell1@gmail.com>2013-05-01 15:39:02 -0400
commitd096b7ac4a2435339f7a7e3de68c51efc07422a0 (patch)
tree77baaffeb0f75e401ee89849daa0f4bc4d3d99af /chat_request.h
parent79230604a20409ab12c2cb9620df81078ff7fae2 (diff)
It's beautiful. But actually. Oh my god.
Diffstat (limited to 'chat_request.h')
-rw-r--r--chat_request.h25
1 files changed, 5 insertions, 20 deletions
diff --git a/chat_request.h b/chat_request.h
index d57d7e1..6b4db03 100644
--- a/chat_request.h
+++ b/chat_request.h
@@ -6,11 +6,10 @@
*/
-void *send_chat_request(void * arg) {
+void send_chat_request(char * username) {
int i;
char ip[16];
- char * username = (char *) arg;
pthread_mutex_lock(&peer_table_lock);
@@ -22,10 +21,10 @@ void *send_chat_request(void * arg) {
pthread_mutex_unlock(&peer_table_lock);
- struct sockaddr_in server_addr;
- char out_buf[GLOBAL_MSG_LENGTH];
- char in_buf[GLOBAL_MSG_LENGTH];
- int retcode;
+ struct sockaddr_in server_addr;
+ char out_buf[GLOBAL_MSG_LENGTH];
+ char in_buf[GLOBAL_MSG_LENGTH];
+ int retcode;
// create the socket
client_s = socket(AF_INET, SOCK_STREAM, 0);
@@ -51,8 +50,6 @@ void *send_chat_request(void * arg) {
strcpy(out_buf, "SESREQ");
send(client_s, out_buf, strlen(out_buf), 0);
-
-
retcode = recv(client_s, in_buf, sizeof(in_buf), 0);
if (strcmp(in_buf, "SESANS:Y") == 0) {
@@ -74,15 +71,3 @@ void *send_chat_request(void * arg) {
return;
}
-void start_chat_request_thread(char * user) {
-
- pthread_create(&requester_t, NULL, send_chat_request, (void *)user);
-
- sleep(10);
-
- printf("Request timed out. \n");
-
- pthread_cancel(requester_t);
-
- return;
-} \ No newline at end of file