From: Felix Fietkau Date: Tue, 24 Jun 2014 20:42:14 +0000 (+0200) Subject: libubus: fix deferring invoke processing for non-uloop usage X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3869e0ca0774e8f17597db5b60bee97d21b5b1fa;p=project%2Fubus.git libubus: fix deferring invoke processing for non-uloop usage Signed-off-by: Felix Fietkau --- diff --git a/libubus-req.c b/libubus-req.c index 7378a92..f24f033 100644 --- a/libubus-req.c +++ b/libubus-req.c @@ -171,9 +171,13 @@ int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req, if (req->complete_cb) req->complete_cb(req, status); - if (!registered) + if (!registered) { uloop_fd_delete(&ctx->sock); + if (ctx->stack_depth) + ctx->pending_timer.cb(&ctx->pending_timer); + } + return status; } diff --git a/libubus.c b/libubus.c index e852519..1a550c1 100644 --- a/libubus.c +++ b/libubus.c @@ -81,7 +81,8 @@ ubus_queue_msg(struct ubus_context *ctx, struct ubus_msghdr *hdr) memcpy(&pending->hdr, hdr, sizeof(*hdr) + blob_raw_len(ubus_msghdr_data(hdr))); list_add(&pending->list, &ctx->pending); - uloop_timeout_set(&ctx->pending_timer, 1); + if (ctx->sock.registered) + uloop_timeout_set(&ctx->pending_timer, 1); } void __hidden