Update the fault tolerant code
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 12 Dec 2013 13:31:07 +0000 (22:31 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 12 Dec 2013 13:31:07 +0000 (22:31 +0900)
Change-Id: I5395e4899025c2037aceb2cc046920d8c43266e7

packaging/data-provider-master.spec
src/instance.c
src/server.c

index 5ec7933..73aeeca 100755 (executable)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes
-Version: 0.28.1
+Version: 0.28.2
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index d6c1bc2..53dd9e4 100644 (file)
@@ -2719,6 +2719,11 @@ HAPI int instance_recover_state(struct inst_info *inst)
                return LB_STATUS_SUCCESS;
        }
 
+       if (package_is_fault(inst->info)) {
+               ErrPrint("Package is faulted(%s), Delete it\n", inst->id);
+               inst->requested_state = INST_DESTROYED;
+       }
+
        switch (inst->state) {
        case INST_ACTIVATED:
        case INST_REQUEST_TO_REACTIVATE:
@@ -2759,7 +2764,6 @@ HAPI int instance_recover_state(struct inst_info *inst)
                        DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
                        instance_state_reset(inst);
                        instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       ret = 1;
                        break;
                default:
                        break;
index 6ca49e9..295fd88 100644 (file)
@@ -972,6 +972,7 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
        const char *pkgname;
        const char *id;
        struct inst_info *inst;
+       const struct pkg_info *pkg;
        int ret;
 
        client = client_find_by_rpc_handle(handle);
@@ -993,11 +994,17 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
         * Trust the package name which are sent by the client.
         * The package has to be a livebox package name.
         */
-       ret = validate_request(pkgname, id, &inst, NULL);
+       ret = validate_request(pkgname, id, &inst, &pkg);
        if (ret != LB_STATUS_SUCCESS) {
                goto out;
        }
 
+       if (package_is_fault(pkg)) {
+               DbgPrint("Faulted package. will be deleted soon: %s\n", id);
+               ret = LB_STATUS_ERROR_FAULT;
+               goto out;
+       }
+
        if (instance_client(inst) != client) {
                if (instance_has_client(inst, client)) {
                        struct deleted_item *item;