From 061a477a205ecea1f99b3f581313f67fbfa9c88d Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Sat, 30 Dec 2017 18:29:20 +0100 Subject: [PATCH] fix if own station is already connected --- src/storage/datastorage.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index f5a2365..f75c2e6 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -271,14 +271,21 @@ int compare_station_count(uint8_t *bssid_addr_own, uint8_t *bssid_addr_to_compar 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("IS ALREADY CONNECTED! DECREASE COUNTER!!!\n"); + printf("COMPARE IS ALREADY CONNECTED! DECREASE COUNTER!!!\n"); sta_count_to_compare--; } - return (int)ap_entry_own.station_count > sta_count_to_compare; + return sta_count > sta_count_to_compare; } /*