ucode: fix ubus defer when running from within eloop (integrated with uloop)
[openwrt/staging/pepe2k.git] / package / utils / ucode / patches / 100-ubus-fix-uc_ubus_have_uloop-for-eloop-uloop-combinat.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 1 May 2024 18:40:19 +0200
3 Subject: [PATCH] ubus: fix uc_ubus_have_uloop for eloop+uloop combination
4
5 When uloop has been integrated with eloop (in hostapd/wpa_supplicant),
6 uloop_cancelling will return false, since uloop_run is not being called.
7 This leads to ubus.defer() calling uloop_run in a context where it can
8 prevent the other event loop from running.
9
10 Fix this by detecting event loop integration via uloop_fd_set_cb being set
11
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 ---
14
15 --- a/lib/ubus.c
16 +++ b/lib/ubus.c
17 @@ -665,6 +665,9 @@ uc_ubus_have_uloop(void)
18 bool prev = uloop_cancelled;
19 bool active;
20
21 + if (uloop_fd_set_cb)
22 + return true;
23 +
24 uloop_cancelled = true;
25 active = uloop_cancelling();
26 uloop_cancelled = prev;