sta: uniform disconnect state handling

Logic for handling STA transition to disconnected state is
present multiple times. Create a new method to remove
duplicate code.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2021-11-28 23:20:48 +01:00
parent 806e647cbc
commit 55e98d852c
4 changed files with 10 additions and 5 deletions

9
sta.c
View File

@@ -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)
{