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

2014-09-15 Thread Alexandru Ardelean
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@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-09-15 Thread Felix Fietkau
On 2014-09-15 14:42, Alexandru Ardelean wrote:
 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.
Looks good to me, applied to git.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2014-09-15 Thread Alexandru Ardelean
Cool.
Thanks.

On Mon, Sep 15, 2014 at 4:49 PM, Felix Fietkau n...@openwrt.org wrote:

 On 2014-09-15 14:42, Alexandru Ardelean wrote:
  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.
 Looks good to me, applied to git.

 - Felix

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel