3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 20:12:37 +01:00

network: Drop actions to be handled by filesystem watch

This commit is contained in:
Andrew Zaborowski 2018-08-09 16:33:44 +02:00 committed by Denis Kenzior
parent 5f79acfd8d
commit ca270e9de2
3 changed files with 8 additions and 50 deletions

View File

@ -160,25 +160,6 @@ struct network_info *known_networks_find(const char *ssid,
return l_queue_find(known_networks, network_info_match, &query);
}
void known_networks_connected(struct network_info *network)
{
bool is_new;
is_new = !l_queue_remove(known_networks, network);
l_queue_push_head(known_networks, network);
if (is_new && network->is_hidden)
num_known_hidden_networks++;
if (is_new)
known_network_register_dbus(network);
else
l_dbus_property_changed(dbus_get_bus(),
iwd_known_network_get_path(network),
IWD_KNOWN_NETWORK_INTERFACE,
"LastConnectedTime");
}
static struct l_dbus_message *known_network_forget(struct l_dbus *dbus,
struct l_dbus_message *message,
void *user_data)
@ -186,19 +167,9 @@ static struct l_dbus_message *known_network_forget(struct l_dbus *dbus,
struct network_info *network = user_data;
struct l_dbus_message *reply;
if (network->is_hidden)
num_known_hidden_networks--;
l_queue_remove(known_networks, network);
l_dbus_unregister_object(dbus, iwd_known_network_get_path(network));
/* Other actions taken care of by the filesystem watch callback */
storage_network_remove(network->type, network->ssid);
/*
* network_info_forget_known will either re-add the network_info to
* its seen networks lists or call network_info_free.
*/
network_info_forget_known(network);
reply = l_dbus_message_new_method_return(message);
l_dbus_message_set_arguments(reply, "");

View File

@ -31,7 +31,6 @@ bool known_networks_foreach(known_networks_foreach_func_t function,
bool known_networks_has_hidden(void);
struct network_info *known_networks_find(const char *ssid,
enum security security);
void known_networks_connected(struct network_info *network);
bool known_networks_init(void);
void known_networks_exit(void);

View File

@ -119,6 +119,10 @@ void network_connected(struct network *network)
{
int err;
/*
* This triggers an update to network->info->connected_time and
* other possible actions in knownnetworks.c.
*/
err = storage_network_touch(network_get_security(network),
network->info->ssid);
switch (err) {
@ -143,24 +147,8 @@ void network_connected(struct network *network)
break;
}
err = storage_network_get_mtime(network_get_security(network),
network->info->ssid,
&network->info->connected_time);
if (err < 0)
l_error("Error %i reading network timestamp", err);
l_queue_foreach_remove(network->secrets,
network_secret_check_cacheable, network);
/*
* If this is the first ever connection to this network, we move the
* network_info to the Known Networks list. Otherwise this only has
* the effect of updating the connected time on the Known Network
* and moving it to the top of the list for network_find_rank_index's
* purposes.
*/
l_queue_remove(networks, network->info);
known_networks_connected(network->info);
}
void network_disconnected(struct network *network)
@ -1000,9 +988,9 @@ void network_connect_new_hidden_network(struct network *network,
l_debug("");
/*
* This is not a Known Network. If connection succeeds,
* known_networks_connected() is going to be called and will save
* this network as hidden and update the hidden networks count.
* This is not a Known Network. If connection succeeds, either
* network_sync_psk or network_connected will save this network
* as hidden and trigger an update to the hidden networks count.
*/
network->info->is_hidden = true;