Don't try to make a connection from discon cb.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 20 May 2013 11:30:34 +0000 (20:30 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 20 May 2013 11:30:34 +0000 (20:30 +0900)
Change-Id: I10ac77e38f01643ae63d3da5165e169808bd384f

lib/src/icon.c
lib/src/main.c
packaging/libshortcut.spec

index c29445b..b4eddce 100644 (file)
@@ -264,7 +264,7 @@ static inline struct block *find_block(struct shortcut_desc *handle, const char
        struct dlist *l;
 
        dlist_foreach(handle->block_list, l, block) {
-               if (!strcmp(block->part, part) && !strcmp(block->id, id))
+               if (!strcmp(block->part, part) && (!id || !strcmp(block->id, id)))
                        return block;
        }
 
index 0a27aa3..bbba095 100644 (file)
@@ -51,6 +51,7 @@ static struct info {
        } server_cb;
        int initialized;
        int db_opened;
+       guint timer_id;
 } s_info = {
        .server_fd = -1,
        .client_fd = -1,
@@ -59,6 +60,7 @@ static struct info {
        .handle = NULL,
        .initialized = 0,
        .db_opened = 0,
+       .timer_id = 0,
 };
 
 
@@ -203,6 +205,24 @@ static void master_started_cb(keynode_t *node, void *user_data)
 
 
 
+static gboolean timeout_cb(void *data)
+{
+       int ret;
+
+       ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
+       if (ret < 0)
+               ErrPrint("Failed to add vconf for service state [%d]\n", ret);
+       else
+               DbgPrint("vconf 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.client_fd == handle) {
@@ -211,15 +231,12 @@ static int disconnected_cb(int handle, void *data)
        }
 
        if (s_info.server_fd == handle) {
-               int ret;
-               s_info.server_fd = SHORTCUT_ERROR_INVALID;
-               ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
-               if (ret < 0)
-                       ErrPrint("Failed to add vconf for service state [%d]\n", ret);
-               else
-                       DbgPrint("vconf is registered\n");
-
-               master_started_cb(NULL, NULL);
+               if (!s_info.timer_id) {
+                       s_info.server_fd = SHORTCUT_ERROR_INVALID;
+                       s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL);
+                       if (!s_info.timer_id)
+                               ErrPrint("Unable to add timer\n");
+               }
                return 0;
        }
 
index 54d12f3..d194ff9 100644 (file)
@@ -1,6 +1,6 @@
 Name: libshortcut
 Summary: Shortcut add feature supporting library
-Version: 0.6.1
+Version: 0.6.2
 Release: 0
 Group: HomeTF/Framework
 License: Apache License