summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-11-13 15:03:39 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-11-28 08:47:10 +0100
commitaa48aface7043930a3b31325d6f59340b69721ff (patch)
tree0a425568435a813bc2f1632e5ed03d343faba654
parent7fcb1f60068e77b196e75f3d6e45a37b2f1b6d72 (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. (cherry picked from commit 76e862597cbffd6073523eeb842a886f5d5742e9)
-rw-r--r--src/mm-plugin-manager.c20
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)