[OpenWrt-Devel] [PATCH][RFC] libubus: restore uloop_cancelled on timeout

Alexandru Ardelean ardeleanalex at gmail.com
Mon Sep 15 08:42:09 EDT 2014


Context: 1 loop with a single ubus_invoke() that times out calls
uloop_end() which ends the loop, and thus ends the application.

In the end that seems to confuse procd which outputs a
notification as if the application segfault-ed a couple of
times, rather than ended 'gracefully' by being cancelled.

Not sure if this fix is correct, hence the RFC part.

Another approach would be to increase the timeout of the ubus_invoke() 
call in my application, however, that itself does not look like a 
definitive fix for timing out and cancelling the main uloop.

So, if there are better suggestions, I'm open for them as well.
Another idea, would be to 'restart' the main uloop in case of
the timeout, or cancel the uloop cancel.

---
 libubus-req.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libubus-req.c b/libubus-req.c
index 8475dc9..e70a182 100644
--- a/libubus-req.c
+++ b/libubus-req.c
@@ -153,6 +153,7 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req,
 			timeout = time_end - get_time_msec();
 			if (timeout <= 0) {
 				ubus_set_req_status(req, UBUS_STATUS_TIMEOUT);
+				uloop_cancelled = cancelled;
 				break;
 			}
 		}
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list