rpcd-mod-luci: properly deal with failing ubus requests
authorJo-Philipp Wich <jo@mein.io>
Sun, 3 Nov 2019 18:53:05 +0000 (19:53 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 3 Nov 2019 18:57:14 +0000 (19:57 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libs/rpcd-mod-luci/Makefile
libs/rpcd-mod-luci/src/luci.c

index 01b581d240a92e8010682c3140b39d32f6b6343e..51e311e7f3112ac0594dc622f13b1fece7aebb26 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd-mod-luci
-PKG_VERSION:=20191102
+PKG_VERSION:=20191103
 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
 
 PKG_LICENSE:=Apache-2.0
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);
 }