scan: Make periodic scan optional

This commit is contained in:
Tim Kourt 2018-11-15 12:54:24 -08:00 committed by Denis Kenzior
parent 7b8c069383
commit e4a76018fd
1 changed files with 16 additions and 1 deletions

View File

@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
* Copyright (C) 2015 Intel Corporation. All rights reserved.
* Copyright (C) 2015-2018 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -654,11 +654,26 @@ static bool scan_periodic_send_start(struct scan_context *sc)
return true;
}
static bool scan_periodic_is_disabled(void)
{
const struct l_settings *config = iwd_get_config();
bool disabled;
if (!l_settings_get_bool(config, "Scan", "disable_periodic_scan",
&disabled))
return false;
return disabled;
}
void scan_periodic_start(uint32_t ifindex, scan_trigger_func_t trigger,
scan_notify_func_t func, void *userdata)
{
struct scan_context *sc;
if (scan_periodic_is_disabled())
return;
sc = l_queue_find(scan_contexts, scan_context_match,
L_UINT_TO_PTR(ifindex));