From 8e1c00895404d057841aa045f59c5f2f257a10f3 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 15 Oct 2012 15:55:48 +0300 Subject: [PATCH] adapter: Use idle callbacks for forcing DevicesFound events This way we ensure that we include all found devices from the current mainloop iteration into the DevicesFound signal. --- src/adapter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index 05df20c40..8c8b79058 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2853,11 +2853,10 @@ void adapter_update_found_devices(struct btd_adapter *adapter, pending_count = g_slist_length(discovery->pending); if (discovery->id == 0) { - send_found(adapter); + discovery->id = g_idle_add(send_found, adapter); } else if (pending_count > PENDING_FOUND_MAX) { g_source_remove(discovery->id); - discovery->id = 0; - send_found(adapter); + discovery->id = g_idle_add(send_found, adapter); } } -- 2.47.3