summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-03-28 12:33:00 +0000
committerSung-jae Park <nicesj.park@samsung.com>2013-03-28 12:33:00 +0000
commitc39e4f9636874bfaebdb38a32fbbd2c5a5aceecd (patch)
tree21daf3101a9c1317c026c90126e9c17277493195
parentac0355e195280405342b77b89c4c5abcaa6a69df (diff)
downloaddata-provider-master-c39e4f9636874bfaebdb38a32fbbd2c5a5aceecd.tar.gz
data-provider-master-c39e4f9636874bfaebdb38a32fbbd2c5a5aceecd.tar.bz2
data-provider-master-c39e4f9636874bfaebdb38a32fbbd2c5a5aceecd.zip
Care the case for failing open a PD.
If a provider fails to load script for PD, It should notice to slave provider. Currently, the slave will prevent other boxes update if the PD is opened of a box. So, if the master doesn't send the failed event to the slave, and only client notice it, the slave cannot get any failed or close PD event. then it will block all other boxes update. This patch will fix it. Now if the master fails to load the EDJE for PD, the slave will notice it via close,pd event. then the other box can be updated normally. Change-Id: I44f7bf6378e07adc29656db94993f9af38a71d34
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--src/instance.c28
-rw-r--r--src/server.c47
3 files changed, 55 insertions, 22 deletions
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index 66cacf0..a89ea1c 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.19.0
+Version: 0.19.1
Release: 1
Group: HomeTF/Livebox
License: Flora License
diff --git a/src/instance.c b/src/instance.c
index f1cc6f2..32bc3bd 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -1794,7 +1794,7 @@ static void resize_cb(struct slave_node *slave, const struct packet *packet, voi
int ret;
if (!packet) {
- ErrPrint("Invalid packet\n");
+ ErrPrint("RESIZE: Invalid packet\n");
instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, LB_STATUS_ERROR_FAULT);
instance_unref(cbdata->inst);
DbgFree(cbdata);
@@ -1802,7 +1802,7 @@ static void resize_cb(struct slave_node *slave, const struct packet *packet, voi
}
if (packet_get(packet, "i", &ret) != 1) {
- ErrPrint("Invalid parameter\n");
+ ErrPrint("RESIZE: Invalid parameter\n");
instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, LB_STATUS_ERROR_INVALID);
instance_unref(cbdata->inst);
DbgFree(cbdata);
@@ -1843,10 +1843,12 @@ static void resize_cb(struct slave_node *slave, const struct packet *packet, voi
* to get the size changed event callback correctly.
*/
instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, LB_STATUS_ERROR_ALREADY);
- DbgPrint("Livebox is already resized\n");
+ DbgPrint("RESIZE: Livebox is already resized [%s - %dx%d]\n", instance_id(cbdata->inst), cbdata->w, cbdata->h);
+ } else {
+ DbgPrint("RESIZE: Request is successfully sent [%s - %dx%d]\n", instance_id(cbdata->inst), cbdata->w, cbdata->h);
}
} else {
- DbgPrint("Livebox rejects the new size: %dx%d (%d)\n", cbdata->w, cbdata->h, ret);
+ DbgPrint("RESIZE: Livebox rejects the new size: %s - %dx%d (%d)\n", instance_id(cbdata->inst), cbdata->w, cbdata->h, ret);
instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, ret);
}
@@ -1889,6 +1891,7 @@ HAPI int instance_resize(struct inst_info *inst, int w, int h)
return LB_STATUS_ERROR_FAULT;
}
+ DbgPrint("RESIZE: INSTANCE[%s] Request resize[%dx%d] box\n", instance_id(inst), w, h);
ret = slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, resize_cb, cbdata, 0);
return ret;
}
@@ -2534,9 +2537,24 @@ HAPI int instance_slave_open_pd(struct inst_info *inst, struct client_node *clie
return LB_STATUS_ERROR_FAULT;
}
- slave_freeze_ttl(slave);
+ /*!
+ * \note
+ * Do not return from here even though we failed to freeze the TTL timer.
+ * Because the TTL timer is not able to be exists.
+ * So we can ignore this error.
+ */
+ (void)slave_freeze_ttl(slave);
ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+ if (ret < 0) {
+ ErrPrint("Unable to send request to slave\n");
+ /*!
+ * \note
+ * Also we can ignore the TTL timer at here too ;)
+ */
+ (void)slave_thaw_ttl(slave);
+ return ret;
+ }
/*!
* \note
diff --git a/src/server.c b/src/server.c
index e5b975c..10047d7 100644
--- a/src/server.c
+++ b/src/server.c
@@ -528,6 +528,7 @@ static struct packet *client_resize(pid_t pid, int handle, const struct packet *
}
DbgPrint("pid[%d] pkgname[%s] id[%s] w[%d] h[%d]\n", pid, pkgname, id, w, h);
+ DbgPrint("RESIZE: INSTANCE[%s] Client request resize to %dx%d\n", id, w, h);
/*!
* \NOTE:
@@ -3885,8 +3886,10 @@ out:
static Eina_Bool lazy_pd_created_cb(void *data)
{
- DbgPrint("Send PD Create event\n");
- instance_client_pd_created(data, 0);
+ int ret;
+
+ ret = instance_client_pd_created(data, LB_STATUS_SUCCESS);
+ DbgPrint("Send PD Create event (%d)\n", ret);
instance_unref(data);
return ECORE_CALLBACK_CANCEL;
@@ -3895,7 +3898,7 @@ static Eina_Bool lazy_pd_created_cb(void *data)
static Eina_Bool lazy_pd_destroyed_cb(void *data)
{
DbgPrint("Send PD Destroy event\n");
- instance_client_pd_destroyed(data, 0);
+ instance_client_pd_destroyed(data, LB_STATUS_SUCCESS);
instance_unref(data);
return ECORE_CALLBACK_CANCEL;
@@ -4025,26 +4028,38 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
instance_slave_set_pd_pos(inst, x, y);
ix = x * instance_pd_width(inst);
iy = y * instance_pd_height(inst);
+
script_handler_update_pointer(instance_pd_script(inst), ix, iy, 0);
+
ret = instance_slave_open_pd(inst, client);
- ret = script_handler_load(instance_pd_script(inst), 1);
+ if (ret == LB_STATUS_SUCCESS) {
+ ret = script_handler_load(instance_pd_script(inst), 1);
- /*!
- * \note
- * Send the PD created event to the clients,
- */
- if (ret == 0) {
/*!
* \note
- * But the created event has to be send afte return
- * from this function or the viewer couldn't care
- * the event correctly.
+ * Send the PD created event to the clients,
*/
- inst = instance_ref(inst); /* To guarantee the inst */
- if (!ecore_timer_add(DELAY_TIME, lazy_pd_created_cb, inst))
- instance_unref(inst);
+ if (ret == LB_STATUS_SUCCESS) {
+ /*!
+ * \note
+ * But the created event has to be send afte return
+ * from this function or the viewer couldn't care
+ * the event correctly.
+ */
+ inst = instance_ref(inst); /* To guarantee the inst */
+ if (!ecore_timer_add(DELAY_TIME, lazy_pd_created_cb, inst)) {
+ instance_unref(inst);
+ script_handler_unload(instance_pd_script(inst), 1);
+ instance_slave_close_pd(inst, client);
+
+ ErrPrint("Failed to add delayed timer\n");
+ ret = LB_STATUS_ERROR_FAULT;
+ }
+ } else {
+ instance_slave_close_pd(inst, client);
+ }
} else {
- instance_client_pd_created(inst, ret);
+ ErrPrint("Failed to request open PD to the slave\n");
}
} else {
ErrPrint("Invalid PD TYPE\n");