]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - src/tlsproxy.c
Prepare HTTP_RESPONSE_FORMAT for additional headers.
[tlsproxy/tlsproxy.git] / src / tlsproxy.c
index 0f3481efab96694813d781b9eba91c7b08f5042a..7c4f1da2d122e2d693812ade6f4796082ce79e3a 100644 (file)
@@ -76,7 +76,7 @@ static void print_usage(const char *argv);
 static void initialize_gnutls(void);
 static void deinitialize_gnutls(void);
 
-static void worker_thread(void);
+static void *worker_thread(void *unused);
 
 
 int main(int argc, char **argv) {
@@ -136,9 +136,7 @@ int main(int argc, char **argv) {
         return EXIT_FAILURE;
     }
     for (i = 0; i < thread_count; i++) {
-        errno = pthread_create(threads + i, NULL,
-                                (void * (*)(void *))&worker_thread,
-                                NULL);
+        errno = pthread_create(threads + i, NULL, &worker_thread, NULL);
         if (errno != 0) {
             perror("failed to create worker thread");
             return EXIT_FAILURE;
@@ -225,9 +223,9 @@ int main(int argc, char **argv) {
         }
     }
 
-    free(ringbuffer_full);
-    free(ringbuffer_free);
-    free(ringbuffer_lock);
+    sem_del(ringbuffer_full);
+    sem_del(ringbuffer_free);
+    sem_del(ringbuffer_lock);
 
     free(threads);
 
@@ -384,9 +382,11 @@ static void deinitialize_gnutls(void) {
     gnutls_global_deinit();
 }
 
-static void worker_thread(void) {
+static void *worker_thread(void *unused) {
     int client_socket;
 
+    (void)unused;
+
     for (;;) {
         /* Get next element from ring buffer. */
         P(ringbuffer_full);
@@ -403,4 +403,6 @@ static void worker_thread(void) {
 
         handle_connection(client_socket);
     }
+
+    return NULL;
 }