sta: uniform disconnect state handling
[project/usteer.git] / sta.c
diff --git a/sta.c b/sta.c
index 9ddd81ebdea317bfcb93b76aeb77eaf6a7d3798e..0ec6a8a4d9c4670547c15bd9d42ae4bc31a02a61 100644 (file)
--- a/sta.c
+++ b/sta.c
@@ -105,8 +105,7 @@ usteer_sta_info_get(struct sta *sta, struct usteer_node *node, bool *create)
        *create = true;
 
        /* Node is by default not connected. */
-       si->connected = STA_NOT_CONNECTED;
-       usteer_sta_info_update_timeout(si, config.local_sta_timeout);
+       usteer_sta_disconnected(si);
 
        return si;
 }
@@ -145,6 +144,12 @@ usteer_sta_get(const uint8_t *addr, bool create)
        return sta;
 }
 
+void usteer_sta_disconnected(struct sta_info *si)
+{
+       si->connected = STA_NOT_CONNECTED;
+       usteer_sta_info_update_timeout(si, config.local_sta_timeout);
+}
+
 void
 usteer_sta_info_update(struct sta_info *si, int signal, bool avg)
 {