3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

network: Rely on known_networks removed event

Instead of having known_networks call network_info_forget_known, instead
rely on the newly introduced KNOWN_NETWORKS_EVENT_REMOVED
This commit is contained in:
Denis Kenzior 2019-08-09 12:30:56 -05:00
parent 4fc8bea0a2
commit 0e77bf1c39
3 changed files with 9 additions and 14 deletions

View File

@ -456,7 +456,10 @@ static void known_network_removed(struct network_info *network)
l_dbus_unregister_object(dbus_get_bus(),
known_network_get_path(network));
network_info_forget_known(network);
WATCHLIST_NOTIFY(&known_network_watches,
known_networks_watch_func_t,
KNOWN_NETWORKS_EVENT_REMOVED, network);
network_info_free(network);
}

View File

@ -1339,10 +1339,9 @@ static void emit_known_network_changed(struct station *station, void *user_data)
if (!network)
return;
l_dbus_property_changed(dbus_get_bus(),
network_get_path(network),
IWD_NETWORK_INTERFACE,
"KnownNetwork");
network->info = NULL;
l_dbus_property_changed(dbus_get_bus(), network_get_path(network),
IWD_NETWORK_INTERFACE, "KnownNetwork");
}
struct network_info *network_info_add_known(const char *ssid,
@ -1370,14 +1369,6 @@ static void disconnect_no_longer_known(struct station *station, void *user_data)
station_disconnect(station);
}
void network_info_forget_known(struct network_info *network)
{
memset(&network->connected_time, 0, sizeof(network->connected_time));
station_foreach(emit_known_network_changed, network);
station_foreach(disconnect_no_longer_known, network);
}
static void known_networks_changed(enum known_networks_event event,
const struct network_info *info,
void *user_data)
@ -1386,6 +1377,8 @@ static void known_networks_changed(enum known_networks_event event,
case KNOWN_NETWORKS_EVENT_ADDED:
break;
case KNOWN_NETWORKS_EVENT_REMOVED:
station_foreach(emit_known_network_changed, (void *) info);
station_foreach(disconnect_no_longer_known, (void *) info);
break;
}
}

View File

@ -88,4 +88,3 @@ struct network_info {
struct network_info *network_info_add_known(const char *ssid,
enum security security);
void network_info_forget_known(struct network_info *network);