From e444f6c0afca3e1fef3fdee52b0b500dd1cd42cb Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 28 Mar 2013 09:01:54 +0000 Subject: [PATCH] Send PD close event to the slave if it fails. If the provider(master) failes to load the EDJE of PD, send the failed event to the slave not only to the client. Before apply this patch, the slave couldn't know what happens when the master couldn't open a PD (failed to load EDJE), So the slave always pending all update reuqests. Change-Id: I4767628bfa69cf2d082f69a0f2d62c67908af0e1 --- packaging/data-provider-master.spec | 2 +- src/instance.c | 28 ++++++++++++++++++---- src/server.c | 47 ++++++++++++++++++++++++------------- 3 files changed, 55 insertions(+), 22 deletions(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 4faf5e2..e4fd3ca 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"); -- 2.7.4