From: Felix Fietkau Date: Wed, 19 Oct 2016 12:08:03 +0000 (+0200) Subject: service: make instance_update() void and unconditionally replace config on update X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=29d2adb14bb1e9715b1391d2724b281d01ef8d0a;p=project%2Fprocd.git service: make instance_update() void and unconditionally replace config on update Signed-off-by: Felix Fietkau --- diff --git a/service/instance.c b/service/instance.c index 10e35ca..bfc0979 100644 --- a/service/instance.c +++ b/service/instance.c @@ -919,25 +919,21 @@ instance_config_move(struct service_instance *in, struct service_instance *in_sr in_src->config = NULL; } -bool +void instance_update(struct service_instance *in, struct service_instance *in_new) { bool changed = instance_config_changed(in, in_new); bool running = in->proc.pending; - if (!changed && running) - return false; - if (!running) { - if (changed) - instance_config_move(in, in_new); + instance_config_move(in, in_new); instance_start(in); } else { - instance_restart(in); + if (changed) + instance_restart(in); instance_config_move(in, in_new); /* restart happens in the child callback handler */ } - return true; } void diff --git a/service/instance.h b/service/instance.h index 1ee0429..6f95a2a 100644 --- a/service/instance.h +++ b/service/instance.h @@ -80,7 +80,7 @@ struct service_instance { void instance_start(struct service_instance *in); void instance_stop(struct service_instance *in); -bool instance_update(struct service_instance *in, struct service_instance *in_new); +void instance_update(struct service_instance *in, struct service_instance *in_new); void instance_init(struct service_instance *in, struct service *s, struct blob_attr *config); void instance_free(struct service_instance *in); void instance_dump(struct blob_buf *b, struct service_instance *in, int debug);