3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +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); 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, static struct l_dbus_message *known_network_forget(struct l_dbus *dbus,
struct l_dbus_message *message, struct l_dbus_message *message,
void *user_data) 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 network_info *network = user_data;
struct l_dbus_message *reply; struct l_dbus_message *reply;
if (network->is_hidden) /* Other actions taken care of by the filesystem watch callback */
num_known_hidden_networks--;
l_queue_remove(known_networks, network);
l_dbus_unregister_object(dbus, iwd_known_network_get_path(network));
storage_network_remove(network->type, network->ssid); 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); reply = l_dbus_message_new_method_return(message);
l_dbus_message_set_arguments(reply, ""); 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); bool known_networks_has_hidden(void);
struct network_info *known_networks_find(const char *ssid, struct network_info *known_networks_find(const char *ssid,
enum security security); enum security security);
void known_networks_connected(struct network_info *network);
bool known_networks_init(void); bool known_networks_init(void);
void known_networks_exit(void); void known_networks_exit(void);

View File

@ -119,6 +119,10 @@ void network_connected(struct network *network)
{ {
int err; 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), err = storage_network_touch(network_get_security(network),
network->info->ssid); network->info->ssid);
switch (err) { switch (err) {
@ -143,24 +147,8 @@ void network_connected(struct network *network)
break; 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, l_queue_foreach_remove(network->secrets,
network_secret_check_cacheable, network); 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) void network_disconnected(struct network *network)
@ -1000,9 +988,9 @@ void network_connect_new_hidden_network(struct network *network,
l_debug(""); l_debug("");
/* /*
* This is not a Known Network. If connection succeeds, * This is not a Known Network. If connection succeeds, either
* known_networks_connected() is going to be called and will save * network_sync_psk or network_connected will save this network
* this network as hidden and update the hidden networks count. * as hidden and trigger an update to the hidden networks count.
*/ */
network->info->is_hidden = true; network->info->is_hidden = true;