Nothing to see here, move along...

This commit is contained in:
2016-09-17 15:02:58 +03:00
parent 1c2473505d
commit 95a6f1fe97
8 changed files with 54 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
#include "client_pool.h"
#include "log.h"
#include "job_queue.h"
#include "protocol.h"
#include <pthread.h>
#include <unistd.h>
@@ -30,6 +31,9 @@ static void* servlet(void *args) /* Serve the connection -- threadable */
log(WARNING, "SSL_accept() failed. Reason below:");
log_ssl();
} else {
int queue_id = start_msg_queue();
if (queue_id == FAIL)
goto exit;
do {
//buf.meta.type = GET_MEMORY;
//sleep(1);
@@ -45,6 +49,7 @@ static void* servlet(void *args) /* Serve the connection -- threadable */
log(VERBOSE, "Client msg: \"%s\"", buf.chunk.data);
/* TODO: Insert msg handler here */
add_msg_to_queue(queue_id, buf);
continue;
}
@@ -59,6 +64,7 @@ static void* servlet(void *args) /* Serve the connection -- threadable */
log(INFO, "Client [%s] disconnected.", client->ip);
} while (bytes);
}
exit:
SSL_free(client->ssl); /* release SSL state */
close(client->sd); /* close connection */
client->busy = 0;
@@ -134,4 +140,6 @@ void* client_pool(void *args)
}
pthread_attr_destroy(&attr);
pthread_mutex_destroy(&mutex);
pthread_detach(pthread_self());
pthread_exit(NULL);
}