X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=service%2Fwatch.c;h=349b484a788edb8080835b294d8132a67f6f5f04;hp=1d7cf786175dfa33b15ce2e7712c23276d82e240;hb=8ce928994027019c858a523f2a2078736f8e2c5d;hpb=0467aebb79f64d1c9d05a84367fda7c02c4ea6b8;ds=sidebyside diff --git a/service/watch.c b/service/watch.c index 1d7cf78..349b484 100644 --- a/service/watch.c +++ b/service/watch.c @@ -26,11 +26,6 @@ struct watch_object { char *name; }; -struct watch_subscribe { - struct uloop_timeout t; - uint32_t id; -}; - static struct ubus_event_handler watch_event; static struct ubus_subscriber watch_subscribe; static LIST_HEAD(watch_objects); @@ -65,7 +60,7 @@ static void watch_subscribe_cb(struct ubus_context *ctx, struct ubus_event_handl continue; if (!ubus_subscribe(ctx, &watch_subscribe, id)) return; - ERROR("failed to suscribe %d\n", id); + ERROR("failed to subscribe %d\n", id); } } @@ -100,11 +95,11 @@ watch_notify_cb(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) { - if (1 || debug >= 3) { + if (debug >= 3) { char *str; str = blobmsg_format_json(msg, true); - LOG("Received ubus notify '%s': %s\n", method, str); + DEBUG(3, "Received ubus notify '%s': %s\n", method, str); free(str); } @@ -117,8 +112,8 @@ watch_ubus(struct ubus_context *ctx) { watch_event.cb = watch_subscribe_cb; watch_subscribe.cb = watch_notify_cb; - if (ubus_register_event_handler(ctx, &watch_event, "ubus.object.add")) - ERROR("failed to add ubus event handler\n"); if (ubus_register_subscriber(ctx, &watch_subscribe)) ERROR("failed to register ubus subscriber\n"); + if (ubus_register_event_handler(ctx, &watch_event, "ubus.object.add")) + ERROR("failed to add ubus event handler\n"); }