rpcd-mod-luci: properly deal with failing ubus requests
[project/luci.git] / libs / rpcd-mod-luci / src / luci.c
index 91f6798d79620dfd6f7e1be63d9f6f97ded8b1d5..12a22c889126fa13a17e9cb302c8c2aea22b17b0 100644 (file)
@@ -83,6 +83,8 @@ invoke_data_cb(struct ubus_request *req, int type, struct blob_attr *msg)
 
        if (ictx->cb != NULL)
                ictx->cb(req, type, msg);
+
+       ictx->cb = NULL;
 }
 
 static void
@@ -91,6 +93,9 @@ invoke_done_cb(struct ubus_request *req, int ret)
        struct invoke_context *ictx =
                container_of(req, struct invoke_context, request);
 
+       if (ictx->cb != NULL)
+               ictx->cb(req, -1, NULL);
+
        uloop_timeout_cancel(&ictx->timeout);
        free(ictx);
 }