diff options
Diffstat (limited to 'src/adapter.c')
-rw-r--r-- | src/adapter.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c index bc49090c..43f0521f 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2739,6 +2739,21 @@ void adapter_set_state(struct adapter *adapter, int state) if (!adapter) return; + /* Both Standard and periodic Inquiry are in progress */ + if ((state & STD_INQUIRY) && (state & PERIODIC_INQUIRY)) + goto set; + + if (!adapter->found_devices) + goto set; + + /* Free list if standard/periodic inquiry is done */ + if ((adapter->state & (STD_INQUIRY | PERIODIC_INQUIRY)) && + (state & (~STD_INQUIRY | ~PERIODIC_INQUIRY))) { + g_slist_foreach(adapter->found_devices, (GFunc) g_free, NULL); + g_slist_free(adapter->found_devices); + adapter->found_devices = NULL; + } +set: adapter->state = state; } |