From: David Bauer Date: Sat, 11 Dec 2021 11:48:10 +0000 (+0100) Subject: sta: remove duplicate code X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=806e647cbcfe682301abaa4efa2b707015474fda;p=project%2Fusteer.git sta: remove duplicate code Move the sta frequency-seen logic to usteer_sta_info_update. This method is called on every occurence the seen frequency is set now, thus removing the duplicate code. Signed-off-by: David Bauer --- diff --git a/local_node.c b/local_node.c index 613dac3..fb881d1 100644 --- a/local_node.c +++ b/local_node.c @@ -173,11 +173,6 @@ usteer_local_node_assoc_update(struct sta_info *si, struct blob_attr *data) } si->connected = STA_CONNECTED; } - - if (si->node->freq < 4000) - si->sta->seen_2ghz = 1; - else - si->sta->seen_5ghz = 1; } static void diff --git a/sta.c b/sta.c index 7bca10e..9ddd81e 100644 --- a/sta.c +++ b/sta.c @@ -156,6 +156,12 @@ usteer_sta_info_update(struct sta_info *si, int signal, bool avg) si->signal = signal; si->seen = current_time; + + if (si->node->freq < 4000) + si->sta->seen_2ghz = 1; + else + si->sta->seen_5ghz = 1; + usteer_sta_info_update_timeout(si, config.local_sta_timeout); } @@ -173,11 +179,6 @@ usteer_handle_sta_event(struct usteer_node *node, const uint8_t *addr, if (!sta) return -1; - if (freq < 4000) - sta->seen_2ghz = 1; - else - sta->seen_5ghz = 1; - si = usteer_sta_info_get(sta, node, &create); usteer_sta_info_update(si, signal, false); si->roam_scan_done = current_time;