sta: remove duplicate code
authorDavid Bauer <mail@david-bauer.net>
Sat, 11 Dec 2021 11:48:10 +0000 (12:48 +0100)
committerDavid Bauer <mail@david-bauer.net>
Sun, 9 Jan 2022 00:57:32 +0000 (01:57 +0100)
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 <mail@david-bauer.net>
local_node.c
sta.c

index 613dac31e4188d8a9a50e73bc668adb4bc90c3db..fb881d1c6af129bc7ce66b2644d38441d7448fd4 100644 (file)
@@ -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 7bca10ec02b05d5d3f001828e34981a57fba0409..9ddd81ebdea317bfcb93b76aeb77eaf6a7d3798e 100644 (file)
--- 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;