Update to change server state before logging 95/147295/1 submit/tizen_4.0/20170904.014922
authorYoungHun Kim <yh8004.kim@samsung.com>
Sun, 3 Sep 2017 23:41:05 +0000 (08:41 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Mon, 4 Sep 2017 01:37:23 +0000 (10:37 +0900)
Change-Id: I05b52825b90b7fc8ceba8c99108103c9b2dfd7ed

client/src/muse_client.c
packaging/mused.spec
server/src/muse_server.c
server/src/muse_server_private.c

index 59c3ab2..6b1dd97 100644 (file)
@@ -33,8 +33,6 @@ struct sigaction muse_client_abrt_old_action;
 struct sigaction muse_client_segv_old_action;
 struct sigaction muse_client_term_old_action;
 struct sigaction muse_client_sys_old_action;
-static void _muse_client_sigaction(int signo, siginfo_t *siginfo, void *context);
-static void _muse_client_constructor() __attribute__((constructor));
 
 GMutex g_muse_client_mutex;
 GHashTable *g_muse_client_table;
@@ -42,12 +40,13 @@ int g_muse_client_table_id;
 
 const char *UDS_files[MUSE_CHANNEL_MAX] = {MUSE_SOCK_FILE0, MUSE_SOCK_FILE1};
 
+static void _muse_client_sigaction(int signo, siginfo_t *siginfo, void *context);
+static void _muse_client_constructor(void) __attribute__((constructor));
 static int _muse_client_new(muse_channel_e channel);
 static void _muse_client_table_new(void);
 static gpointer _muse_client_get_fd_ptr(int sock_fd);
 static gboolean _muse_client_table_remove_func(gpointer key, gpointer value, gpointer user_data);
 
-
 static gboolean _muse_client_table_remove_func(gpointer key, gpointer value, gpointer user_data)
 {
        int sock_fd = GPOINTER_TO_INT(key);
@@ -69,9 +68,7 @@ static void _muse_client_sigaction(int signo, siginfo_t *siginfo, void *context)
        /* close all opened fds */
        g_mutex_lock(&g_muse_client_mutex);
 
-       g_hash_table_foreach_remove(g_muse_client_table,
-               _muse_client_table_remove_func,
-               NULL);
+       g_hash_table_foreach_remove(g_muse_client_table, _muse_client_table_remove_func, NULL);
 
        g_mutex_unlock(&g_muse_client_mutex);
 
@@ -107,8 +104,7 @@ static void _muse_client_sigaction(int signo, siginfo_t *siginfo, void *context)
        return;
 }
 
-
-static void _muse_client_constructor()
+static void _muse_client_constructor(void)
 {
        struct sigaction muse_client_action;
        muse_client_action.sa_sigaction = _muse_client_sigaction;
@@ -129,7 +125,6 @@ static void _muse_client_constructor()
        return;
 }
 
-
 static int _muse_client_new(muse_channel_e channel)
 {
        struct sockaddr_un address;
index 9a06dd0..e069031 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.4
+Version:    0.3.5
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index b023d92..fb5e837 100644 (file)
@@ -42,7 +42,7 @@ static int _muse_server_pidfile_create(const char *path, pid_t pid);
 static void _muse_server_setup_syslog(void)
 {
        int flags = LOG_CONS|LOG_NDELAY|LOG_PID;
-       if (isatty(1))
+       if (isatty(STDOUT_FILENO))
                flags |= LOG_PERROR;
 
        openlog("mused", flags, LOG_DAEMON);
index b3df89b..02f1b91 100644 (file)
@@ -273,7 +273,7 @@ static gboolean _muse_server_connection_handler(GIOChannel *source, GIOCondition
 
        if (server->state != MUSE_SERVER_STATE_READY) {
                LOGW("Now mused state is not ready...");
-               muse_server_main_thread_unlock();
+               muse_server_state_unlock();
                return FALSE;
        }
 
@@ -347,6 +347,10 @@ static void _muse_server_check_memory(pid_t pid)
        if (g_queue_is_empty(muse_server_ipc_get_instance()->module_queue) && server->state != MUSE_SERVER_STATE_IDLE) {
                if (used_pss_mb > muse_server_config_get_instance()->memory_threshold) {
 
+                       muse_server_state_lock();
+                       server->state = MUSE_SERVER_STATE_IDLE;
+                       muse_server_state_unlock();
+
                        muse_server_log_process_info(pid);
 
                        snprintf(err_msg, sizeof(err_msg), "[Memory Leak] %d > %d",