service: make instance_update() void and unconditionally replace config on update
authorFelix Fietkau <nbd@nbd.name>
Wed, 19 Oct 2016 12:08:03 +0000 (14:08 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 19 Oct 2016 12:08:03 +0000 (14:08 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
service/instance.c
service/instance.h

index 10e35ca6f295dc21aa041e3ae3eedd6b67e07c55..bfc0979c0fbab607a6c0a93de07294d3f9dc1821 100644 (file)
@@ -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
index 1ee04292dcedc2a737c66b247e7b0f3902537088..6f95a2aab819a63f8e827296aae8b4cc3bd228ff 100644 (file)
@@ -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);