diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-11-13 15:03:39 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-11-13 15:38:45 +0100 |
commit | 76e862597cbffd6073523eeb842a886f5d5742e9 (patch) | |
tree | 0feeeae16952b77ac2f2d98e3c799dc9deff9bc8 /src/mm-plugin-manager.c | |
parent | d7d2b9108e12f86f50f82f124066fab46792bd44 (diff) |
plugin-manager: fix waiting the minimum probing time
The device port probings were being finished before the minimum
probing time, making this timeout effectively useless.
Diffstat (limited to 'src/mm-plugin-manager.c')
-rw-r--r-- | src/mm-plugin-manager.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index f0045af7..fb21305d 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -812,6 +812,15 @@ device_context_complete (DeviceContext *device_context) { GTask *task; + /* If the context is completed before the minimum probing time, we need to wait + * until that happens, so that we give enough time to udev/hotplug to report the + * new port additions. */ + if (device_context->min_probing_time_id) { + mm_dbg ("[plugin manager] task %s: all port probings completed, but not reached min probing time yet", + device_context->name); + return; + } + /* Steal the task from the context */ g_assert (device_context->task); task = device_context->task; @@ -831,15 +840,8 @@ device_context_complete (DeviceContext *device_context) device_context->released_id = 0; } - /* Remove timeouts, if still around */ - if (device_context->min_wait_time_id) { - g_source_remove (device_context->min_wait_time_id); - device_context->min_wait_time_id = 0; - } - if (device_context->min_probing_time_id) { - g_source_remove (device_context->min_probing_time_id); - device_context->min_probing_time_id = 0; - } + /* On completion, the minimum wait time must have been already elapsed */ + g_assert (!device_context->min_wait_time_id); /* Task completion */ if (!device_context->best_plugin) |