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:
@@ -249,8 +249,7 @@ usteer_local_node_set_assoc(struct usteer_local_node *ln, struct blob_attr *cl)
|
||||
if (si->connected != STA_DISCONNECTED)
|
||||
continue;
|
||||
|
||||
si->connected = STA_NOT_CONNECTED;
|
||||
usteer_sta_info_update_timeout(si, config.local_sta_timeout);
|
||||
usteer_sta_disconnected(si);
|
||||
MSG(VERBOSE, "station "MAC_ADDR_FMT" disconnected from node %s\n",
|
||||
MAC_ADDR_DATA(si->sta->addr), usteer_node_name(node));
|
||||
}
|
||||
|
9
sta.c
9
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)
|
||||
{
|
||||
|
2
ubus.c
2
ubus.c
@@ -578,7 +578,7 @@ void usteer_ubus_kick_client(struct sta_info *si)
|
||||
blobmsg_add_u32(&b, "reason", config.load_kick_reason_code);
|
||||
blobmsg_add_u8(&b, "deauth", 1);
|
||||
ubus_invoke(ubus_ctx, ln->obj_id, "del_client", b.head, NULL, 0, 100);
|
||||
si->connected = STA_NOT_CONNECTED;
|
||||
usteer_sta_disconnected(si);
|
||||
si->roam_kick = current_time;
|
||||
}
|
||||
|
||||
|
1
usteer.h
1
usteer.h
@@ -275,6 +275,7 @@ struct sta_info *usteer_sta_info_get(struct sta *sta, struct usteer_node *node,
|
||||
|
||||
bool usteer_sta_supports_beacon_measurement_mode(struct sta *sta, enum usteer_beacon_measurement_mode mode);
|
||||
|
||||
void usteer_sta_disconnected(struct sta_info *si);
|
||||
void usteer_sta_info_update_timeout(struct sta_info *si, int timeout);
|
||||
void usteer_sta_info_update(struct sta_info *si, int signal, bool avg);
|
||||
|
||||
|
Reference in New Issue
Block a user