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;
}
} server_cb;
int initialized;
int db_opened;
+ guint timer_id;
} s_info = {
.server_fd = -1,
.client_fd = -1,
.handle = NULL,
.initialized = 0,
.db_opened = 0,
+ .timer_id = 0,
};
+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) {
}
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;
}