From: Sung-jae Park Date: Sat, 18 Jan 2014 14:46:44 +0000 (+0900) Subject: If the viewer sends request without ID to delete an instance, X-Git-Tag: accepted/tizen/generic/20140226.072408~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f408081c5d01be96331421ca63f1d26c71f565d;p=platform%2Fframework%2Fweb%2Fdata-provider-master.git If the viewer sends request without ID to delete an instance, Master should try to find an instance using timestamp. Change-Id: Icb9c3779d61f69062707d3c7d2fffd706f21a498 --- diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 4008e4e..7a38d44 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -1,6 +1,6 @@ Name: data-provider-master Summary: Master service provider for liveboxes -Version: 0.33.4 +Version: 0.33.5 Release: 1 Group: HomeTF/Livebox License: Flora diff --git a/src/server.c b/src/server.c index 3b44180..5fab20d 100644 --- a/src/server.c +++ b/src/server.c @@ -951,6 +951,7 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet * const struct pkg_info *pkg; int ret; int type; + double timestamp; client = client_find_by_rpc_handle(handle); if (!client) { @@ -959,8 +960,8 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet * goto out; } - ret = packet_get(packet, "ssi", &pkgname, &id, &type); - if (ret != 3) { + ret = packet_get(packet, "ssid", &pkgname, &id, &type, ×tamp); + if (ret != 4) { ErrPrint("Parameter is not matched\n"); ret = LB_STATUS_ERROR_INVALID; goto out; @@ -981,7 +982,17 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet * */ ret = validate_request(pkgname, id, &inst, &pkg); if (ret != LB_STATUS_SUCCESS) { - goto out; + DbgPrint("Failed to find by id(%s), try to find it using timestamp(%lf)\n", id, timestamp); + inst = package_find_instance_by_timestamp(pkgname, timestamp); + if (!inst) { + goto out; + } + + pkg = instance_package(inst); + if (!pkg) { + ErrPrint("Package info is not valid: %s\n", id); + goto out; + } } if (package_is_fault(pkg)) {