From b6d5f92a16d8aecff51f8a16373c8e3db6662adb Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Tue, 25 Jul 2017 15:56:28 +0200 Subject: [PATCH] Fix client del bug --- src/storage/datastorage.c | 8 +++++++- src/utils/ubus.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index 6a44e82..79d1700 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -124,7 +124,7 @@ int kick_client(struct client_s client_entry) { break; } if(!mac_is_equal(client_entry.bssid_addr, probe_array[k].bssid_addr) && - own_score < eval_probe_metric(client_entry, probe_array[k])) + own_score < eval_probe_metric(client_entry, probe_array[k])) // that's wrong! find client_entry OR write things in probe array struct! { return 1; } @@ -134,6 +134,9 @@ int kick_client(struct client_s client_entry) { } void kick_clients(uint8_t bssid[]) { + pthread_mutex_lock(&probe_array_mutex); + pthread_mutex_lock(&client_array_mutex); + // Seach for BSSID int i; for (i = 0; i <= client_entry_last; i++) { @@ -158,6 +161,9 @@ void kick_clients(uint8_t bssid[]) { printf("STAAAY CLIENT!!!!!!!!!!!!!\n"); } } + + pthread_mutex_unlock(&probe_array_mutex); + pthread_mutex_unlock(&client_array_mutex); } int client_array_go_next_help(char sort_order[], int i, client entry, diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 00ab43b..54cab93 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -178,7 +178,7 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj, str = blobmsg_format_json(msg, true); send_string(str); - //printf("[WC] Hostapd-Probe: %s : %s\n", method, str); + printf("[WC] Hostapd-Probe: %s : %s\n", method, str); //print_array();