[PATCH] ubus: added ubus_handle_events function that "guaranties" execution of all polled events

Jo-Philipp Wich jo at mein.io
Mon Feb 13 05:12:48 PST 2023


Hi,

> In case of previous setup or calling flow ctx->cancel_poll is set to true
> function ubus_handle_event may process ONLY ONE request, though the comment
> says it processes events:
> 
> /* call this for read events on ctx->sock.fd when not using uloop */ static
> inline void ubus_handle_event(struct ubus_context *ctx) { 
> ctx->sock.cb(&ctx->sock, ULOOP_READ); }
> 
> In case if I would manually poll the ubus fd and do not use uloop to poll
> it and after that it may process ONE event and the rest will be processed
> on the next loop cycle. I would like to have a function that guarantees
> that every request will be processed in a single call to
> ubus_haubus_handle_eventndle_event.

You're already using a foreign event loop / IO notification mechanism, you
already have means to determine socket read readiness. Invoking a library
function that does it's own polling internally with arbitrary, uncontrollable
timeouts does not seem like a good design.

It would be better to implement a function that simply keeps calling
`get_next_msg(ctx, &recv_fd)` and `ubus_process_msg(ctx, &ctx->msgbuf,
recv_fd);` until `get_next_msg()` yields false.

~ Jo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20230213/ede0cfd5/attachment.sig>


More information about the openwrt-devel mailing list