From 5705946da6da6f550575bb5ce1473d0ecc7ec489 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Mon, 20 Nov 2017 19:05:58 +0100 Subject: [PATCH] remove old thread stuff --- src/include/datastorage.h | 7 ------- src/main.c | 17 +---------------- src/storage/datastorage.c | 39 --------------------------------------- src/utils/ubus.c | 4 ---- 4 files changed, 1 insertion(+), 66 deletions(-) diff --git a/src/include/datastorage.h b/src/include/datastorage.h index 4e5dd02..93f845f 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -8,7 +8,6 @@ #include #include #include -#include #ifndef ETH_ALEN #define ETH_ALEN 6 @@ -92,8 +91,6 @@ void print_probe_entry(probe_entry entry); void print_auth_entry(auth_entry entry); -void *remove_probe_array_thread(void *arg); - void uloop_add_data_cbs(); /* AP, Client */ @@ -155,14 +152,10 @@ void print_client_array(); void print_client_entry(client entry); -void *remove_client_array_thread(void *arg); - ap insert_to_ap_array(ap entry); void print_ap_array(); -void *remove_ap_array_thread(void *arg); - ap ap_array_get_ap(uint8_t bssid_addr[]); /* Utils */ diff --git a/src/main.c b/src/main.c index 4dea927..dba35be 100644 --- a/src/main.c +++ b/src/main.c @@ -1,32 +1,18 @@ #include -#include - #include #include -#include -#include #include -#include #include -#include #include "datastorage.h" #include "networksocket.h" #include "ubus.h" #include "dawn_uci.h" -#include "rssi.h" +#include "crypto.h" #define BUFSIZE 17 #define BUFSIZE_DIR 256 - -#include "crypto.h" - -#define _GNU_SOURCE - -#include -#include s - void daemon_shutdown(); void signal_handler(int sig); @@ -34,7 +20,6 @@ void signal_handler(int sig); struct sigaction newSigAction; void daemon_shutdown() { - // kill threads printf("Cancelling Threads!\n"); uloop_cancelled = true; diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index b7783fc..936f652 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -565,19 +565,6 @@ void uloop_add_data_cbs() uloop_timeout_add(&ap_timeout); } -void *remove_probe_array_thread(void *arg) { - printf("Removing thread with time: %lu\n", *(long int *) arg); - time_t time_treshold = *(time_t *) arg; - while (1) { - sleep(time_treshold); - pthread_mutex_lock(&probe_array_mutex); - printf("[Thread] : Removing old entries!\n"); - remove_old_probe_entries(time(0), time_treshold); - pthread_mutex_unlock(&probe_array_mutex); - } - return 0; -} - void remove_probe_array_cb(struct uloop_timeout *t) { pthread_mutex_lock(&probe_array_mutex); printf("[Thread] : Removing old entries!\n"); @@ -586,19 +573,6 @@ void remove_probe_array_cb(struct uloop_timeout *t) { uloop_timeout_set(&probe_timeout, timeout_config.remove_probe * 1000); } -void *remove_client_array_thread(void *arg) { - time_t time_treshold_client = *(time_t *) arg; - printf("Removing client thread with time: %lu\n", time_treshold_client); - while (1) { - sleep(time_treshold_client); - pthread_mutex_lock(&client_array_mutex); - printf("[Thread] : Removing old client entries!\n"); - remove_old_client_entries(time(0), time_treshold_client); - pthread_mutex_unlock(&client_array_mutex); - } - return 0; -} - void remove_client_array_cb(struct uloop_timeout *t) { pthread_mutex_lock(&client_array_mutex); @@ -608,19 +582,6 @@ void remove_client_array_cb(struct uloop_timeout *t) uloop_timeout_set(&client_timeout, timeout_config.update_client * 1000); } -void *remove_ap_array_thread(void *arg) { - time_t time_treshold_ap = *(time_t *) arg; - printf("Removing ap thread with time: %lu\n", time_treshold_ap); - while (1) { - sleep(time_treshold_ap); - pthread_mutex_lock(&ap_array_mutex); - printf("[Thread] : Removing old ap entries!\n"); - remove_old_ap_entries(time(0), time_treshold_ap); - pthread_mutex_unlock(&ap_array_mutex); - } - return 0; -} - void remove_ap_array_cb(struct uloop_timeout *t) { pthread_mutex_lock(&ap_array_mutex); printf("[ULOOP] : Removing old ap entries!\n"); diff --git a/src/utils/ubus.c b/src/utils/ubus.c index b3d599e..33e7488 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -18,7 +18,6 @@ static struct ubus_context *ctx = NULL; static struct ubus_context *ctx_clients; /* own ubus conext otherwise strange behavior... */ -//static struct ubus_context *ctx_hostapd; static struct ubus_subscriber hostapd_event; static struct blob_buf b; @@ -374,12 +373,10 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj, static int add_subscriber(char *name) { uint32_t id = 0; - printf("DOING LOOKUP!\n"); if (ubus_lookup_id(ctx, name, &id)) { fprintf(stderr, "Failed to look up test object for %s\n", name); return -1; } - printf("Lookup success!\n"); if(hostapd_array_check_id(id)) { @@ -466,7 +463,6 @@ int dawn_init_ubus(const char *ubus_socket, char *hostapd_dir) { uloop_timeout_add(&hostapd_timer); // remove probe - //uloop_timeout_add(&probe_timeout); uloop_add_data_cbs(); // get clients