Change the value of timeout in case gst_init does not return 06/218306/10 accepted/tizen/unified/20191125.135538 submit/tizen/20191122.052207
authorYoungHun Kim <yh8004.kim@samsung.com>
Thu, 21 Nov 2019 07:16:37 +0000 (16:16 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Fri, 22 Nov 2019 05:13:14 +0000 (14:13 +0900)
 - Create the server ready file with g_idle_add
 - Update to check the 'remove' return value and add errno for debugging

Change-Id: I1d92c7b28fd502e0d2dafce4754d0acbe251dec9

server/include/muse_server_watchdog.h
server/src/muse_server_config.c
server/src/muse_server_private.c
server/src/muse_server_system.c

index 52c9b3a..59cc62d 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
 
 #include "muse_core_internal.h"
 
-#define MS_WATCHDOG_CHECK_PERIOD                       10
+#define MS_WATCHDOG_CHECK_PERIOD                       30
 #define MS_WATCHDOG_CHECK_COUNT                                3
 #define MS_WATCHDOG_TIMER_PERIOD                       5
 
index 706cf1e..fa2fc72 100644 (file)
@@ -313,8 +313,8 @@ void ms_config_remove_lockfile(void)
 
        muse_return_if_fail(conf);
 
-       if (remove(conf->lockfile) == MUSE_ERR)
-               LOGE("remove %s failed", conf->lockfile);
+       if (remove(conf->lockfile) == -1)
+               LOGE("remove %s failed [errno : %d]", conf->lockfile, errno);
 }
 
 int ms_config_get_min_timeout(void)
index d9ccab5..276ca19 100644 (file)
@@ -67,6 +67,7 @@ static void _ms_unlock_state(void);
 static gboolean _ms_connection_handler(GIOChannel *source, GIOCondition condition, gpointer data);
 #ifdef MUSE_USE_LWIPC
 static void _ms_wait_event(void);
+static gboolean _ms_idle_cb(gpointer user_data);
 
 static void _ms_wait_event(void)
 {
@@ -463,6 +464,14 @@ static void _ms_unlock_state(void)
        g_mutex_unlock(&muse_server->state_lock);
 }
 
+static gboolean _ms_idle_cb(gpointer user_data)
+{
+       if (!ms_create_ready_file())
+               LOGE("%s file creation is failed", MUSE_SERVER_READY);
+
+       return G_SOURCE_REMOVE;
+}
+
 static void _ms_init(void)
 {
        int idx;
@@ -742,6 +751,8 @@ void ms_gst_init(char **cmd)
                        g_error_free(err);
        }
 
+       LOGI("gst_init_check is completed");
+
        /* release */
        free(argv);
        free(argc);
@@ -868,7 +879,7 @@ void ms_init(char **argv)
 
        ms_gst_init(argv);
 
-       LOGD("Leaver");
+       LOGD("Leave");
 }
 
 muse_server_h ms_get_instance(void)
@@ -937,11 +948,11 @@ int ms_deinit(void)
        muse_core_fd_close(muse_server->data_fd);
        for (idx = 0; idx < MUSE_CHANNEL_MAX; idx++) {
                if (remove(UDS_files[idx]) == MUSE_ERR)
-                       LOGE("remove %s falied", UDS_files[idx]);
+                       LOGE("remove %s failed", UDS_files[idx]);
        }
 
-       if (remove(MUSE_DEFAULT_PIDFILE) == MUSE_ERR)
-               LOGE("remove %s falied", MUSE_DEFAULT_PIDFILE);
+       if (remove(MUSE_DEFAULT_PIDFILE) == -1)
+               LOGE("remove %s failed [errno : %d]", MUSE_DEFAULT_PIDFILE, errno);
 
        for (idx = 0; idx < muse_server->conf->host_cnt; idx++)
                ms_module_deinit(muse_server->module[idx]);
@@ -1047,7 +1058,8 @@ void ms_run(void)
        LOGW("Enter");
 
        muse_return_if_fail(muse_server->main_loop);
-       muse_return_if_fail(ms_create_ready_file());
+
+       muse_return_if_fail(g_idle_add(_ms_idle_cb, NULL) > 0);
 
        LOGI("g_main_loop_run");
        g_main_loop_run(muse_server->main_loop);
@@ -1231,7 +1243,7 @@ void ms_remove_ready_file(void)
        if (LwipcResetEvent(MUSE_SERVER_READY) < 0)
                LOGE("Fail to reset light weight IPC");
 #else
-       if (remove(MUSE_SERVER_READY) == MUSE_ERR)
-               LOGE("remove %s failed", MUSE_SERVER_READY);
+       if (remove(MUSE_SERVER_READY) == -1)
+               LOGE("remove %s failed [errno : %d]", MUSE_SERVER_READY, errno);
 #endif
 }
index e8114fa..6f78911 100644 (file)
@@ -317,7 +317,7 @@ void ms_system_init(ms_system_t *system)
 
        g_mutex_init(&system->lock);
 
-       LOGD("Leaver");
+       LOGD("Leave");
 }
 
 void ms_system_deinit(ms_system_t *system)