Message ID | 20210312115942.15049-1-user@fdanis-XPS-13-9370 (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [Bluez,v2] adapter: Fix discovery trigger for 0 second delay | expand |
diff --git a/src/adapter.c b/src/adapter.c index cc0849f99..3078ce1a8 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1797,6 +1797,13 @@ static void trigger_start_discovery(struct btd_adapter *adapter, guint delay) if (!btd_adapter_get_powered(adapter)) return; + if (!delay) { + adapter->discovery_idle_timeout = g_idle_add( + start_discovery_timeout, + adapter); + return; + } + adapter->discovery_idle_timeout = g_timeout_add_seconds(delay, start_discovery_timeout, adapter); }
From: Frédéric Danis <frederic.danis@collabora.com> When calling `StartDiscovery` the effective start can take around 10 ms or up to 700 ms. g_timeout_add_seconds() call doesn't ensure the time for the first call of the timer if the delay is less or equal to 1 second. --- v2: Fix issue founs by CI src/adapter.c | 7 +++++++ 1 file changed, 7 insertions(+)