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)
}
}
+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) {
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;
}
double timestamp;
int ret;
+ timestamp = util_timestamp();
+ DbgPrint("CLICKED: %lf\n", timestamp);
+
if (!handler) {
ErrPrint("Handler is NIL\n");
return LB_STATUS_ERROR_INVALID;
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");