From 50167ac917c1aacff5c7bb51a81f942943fda4a2 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Sat, 30 Dec 2017 19:01:30 +0100 Subject: [PATCH] refactor compare station count --- src/storage/datastorage.c | 43 ++++++++++++--------------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index f75c2e6..3cf5ee9 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -267,39 +267,22 @@ int compare_station_count(uint8_t *bssid_addr_own, uint8_t *bssid_addr_to_compar printf("Comparing own %d to %d\n", ap_entry_own.station_count, ap_entry_to_compre.station_count); - if (automatic_kick) { - return ((int)ap_entry_own.station_count - 1) > (int)ap_entry_to_compre.station_count; - } else { - - int sta_count = ap_entry_own.station_count; - int sta_count_to_compare = ap_entry_to_compre.station_count; - if(is_connected(bssid_addr_own, client_addr)) - { - printf("OWN IS ALREADY CONNECTED! DECREASE COUNTER!!!\n"); - sta_count--; - } - - if(is_connected(bssid_addr_to_compare, client_addr)) - { - printf("COMPARE IS ALREADY CONNECTED! DECREASE COUNTER!!!\n"); - sta_count_to_compare--; - } - - return sta_count > sta_count_to_compare; - } - - /* - int own_count = ap_entry_own.station_count; - if(automatic_kick) + int sta_count = ap_entry_own.station_count; + int sta_count_to_compare = ap_entry_to_compre.station_count; + if(is_connected(bssid_addr_own, client_addr)) { - own_count--; - } - if (is_connected(bssid_addr_to_compare, client_addr)) - { - own_count--; + printf("OWN IS ALREADY CONNECTED! DECREASE COUNTER!!!\n"); + sta_count--; } - return own_count > ap_entry_to_compre.station_count;*/ + if(is_connected(bssid_addr_to_compare, client_addr)) + { + printf("COMPARE IS ALREADY CONNECTED! DECREASE COUNTER!!!\n"); + sta_count_to_compare--; + } + printf("AFTER: Comparing own %d to %d\n", sta_count, sta_count_to_compare); + + return sta_count > sta_count_to_compare; } return 0;