if (req->counter)
(*req->counter)++;
+ /* If this is called in the ORDERED_SET_FOREACH() loop of manager_process_requests(), we need to
+ * exit from the loop, due to the limitation of the iteration on OrderedSet. */
+ manager->request_queued = true;
+
if (ret)
*ret = req;
assert(manager);
+ manager->request_queued = false;
+
ORDERED_SET_FOREACH(req, manager->request_queue) {
_cleanup_(link_unrefp) Link *link = link_ref(req->link);
return 0;
r = req->process(req, link, req->userdata);
- if (r == 0)
- continue; /* The request is not ready. */
+ if (r == 0) { /* The request is not ready. */
+ if (manager->request_queued)
+ break; /* a new request is queued during processing the request. */
+ continue;
+ }
/* If the request sends netlink message, e.g. for Address or so, the Request object is
* referenced by the netlink slot, and will be detached later by its destroy callback.
* hence we need to exit from the loop. */
break;
}
+
+ if (manager->request_queued)
+ break;
}
return 0;