From: Sung-jae Park Date: Mon, 20 May 2013 11:28:44 +0000 (+0900) Subject: Don't try to make a connection again from discon cb X-Git-Tag: accepted/tizen/20131022.083701^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6184dd65a39bfdd19a5f04c952da0ee734ccc9d;p=platform%2Fframework%2Fweb%2Flivebox-viewer.git Don't try to make a connection again from discon cb Change-Id: I7d26a4eb113246e4cea2358bb1268c25b4eaf770 --- diff --git a/packaging/liblivebox-viewer.spec b/packaging/liblivebox-viewer.spec index 167b453..529589c 100644 --- a/packaging/liblivebox-viewer.spec +++ b/packaging/liblivebox-viewer.spec @@ -1,6 +1,6 @@ Name: liblivebox-viewer Summary: Library for developing the application. -Version: 0.13.1 +Version: 0.13.3 Release: 1 Group: HomeTF/Livebox License: Flora License diff --git a/src/client.c b/src/client.c index 76a91b1..18cbbec 100644 --- a/src/client.c +++ b/src/client.c @@ -44,8 +44,10 @@ static struct info { int fd; + guint timer_id; } s_info = { .fd = -1, + .timer_id = 0, }; static struct packet *master_fault_package(pid_t pid, int handle, const struct packet *packet) @@ -1312,6 +1314,19 @@ static void master_started_cb(keynode_t *node, void *data) } } +static gboolean timeout_cb(gpointer data) +{ + if (vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL) < 0) + ErrPrint("Failed to add vconf for monitoring service state\n"); + else + DbgPrint("vconf event callback is registered\n"); + + master_started_cb(NULL, NULL); + + s_info.timer_id = 0; + return FALSE; +} + static int disconnected_cb(int handle, void *data) { if (s_info.fd != handle) { @@ -1326,12 +1341,18 @@ static int disconnected_cb(int handle, void *data) lb_delete_all(); - if (vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL) < 0) - ErrPrint("Failed to add vconf for monitoring service state\n"); - else - DbgPrint("vconf event callback is registered\n"); + /* Try to reconnect after 1 sec later */ + if (!s_info.timer_id) { + DbgPrint("Reconnecting timer is added\n"); + s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL); + if (s_info.timer_id == 0) { + ErrPrint("Unable to add reconnecting timer\n"); + return 0; + } + } else { + ErrPrint("Reconnecting timer is already exists\n"); + } - master_started_cb(NULL, NULL); return 0; } diff --git a/src/livebox.c b/src/livebox.c index 0ceae6f..19fc458 100644 --- a/src/livebox.c +++ b/src/livebox.c @@ -1087,6 +1087,9 @@ EAPI int livebox_click(struct livebox *handler, double x, double y) double timestamp; int ret; + timestamp = util_timestamp(); + DbgPrint("CLICKED: %lf\n", timestamp); + if (!handler) { ErrPrint("Handler is NIL\n"); return LB_STATUS_ERROR_INVALID; @@ -1103,7 +1106,6 @@ EAPI int livebox_click(struct livebox *handler, double x, double y) ErrPrint("Failed to launch app %s\n", handler->lb.auto_launch); } - timestamp = util_timestamp(); packet = packet_create_noack("clicked", "sssddd", handler->pkgname, handler->id, "clicked", timestamp, x, y); if (!packet) { ErrPrint("Failed to build param\n");