libubus: do not send a status reply if UBUS_ATTR_NO_REPLY is set
authorFelix Fietkau <nbd@openwrt.org>
Fri, 14 Dec 2012 19:05:34 +0000 (20:05 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 14 Dec 2012 19:05:34 +0000 (20:05 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
libubus-obj.c

index c35e075..ed18ca9 100644 (file)
@@ -48,6 +48,7 @@ ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hdr,
        struct ubus_request_data req = {};
        int method;
        int ret;
        struct ubus_request_data req = {};
        int method;
        int ret;
+       bool no_reply = false;
 
        if (!obj) {
                ret = UBUS_STATUS_NOT_FOUND;
 
        if (!obj) {
                ret = UBUS_STATUS_NOT_FOUND;
@@ -59,6 +60,9 @@ ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hdr,
                goto send;
        }
 
                goto send;
        }
 
+       if (attrbuf[UBUS_ATTR_NO_REPLY])
+               no_reply = blob_get_int8(attrbuf[UBUS_ATTR_NO_REPLY]);
+
        req.peer = hdr->peer;
        req.seq = hdr->seq;
        req.object = obj->id;
        req.peer = hdr->peer;
        req.seq = hdr->seq;
        req.object = obj->id;
@@ -77,7 +81,7 @@ found:
        ret = obj->methods[method].handler(ctx, obj, &req,
                                           blob_data(attrbuf[UBUS_ATTR_METHOD]),
                                           attrbuf[UBUS_ATTR_DATA]);
        ret = obj->methods[method].handler(ctx, obj, &req,
                                           blob_data(attrbuf[UBUS_ATTR_METHOD]),
                                           attrbuf[UBUS_ATTR_DATA]);
-       if (req.deferred)
+       if (req.deferred || no_reply)
                return;
 
 send:
                return;
 
 send: