Do not execute clean-up right after dispatch_no_instance without destroy dispatch 23/235623/5
authorYoungHun Kim <yh8004.kim@samsung.com>
Mon, 8 Jun 2020 06:38:50 +0000 (15:38 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Tue, 9 Jun 2020 05:31:26 +0000 (14:31 +0900)
 - Add log of module pointer

Change-Id: I7503b987805cdd6b9fd27add9e19841425b469bd

core/src/muse_core.c
packaging/mused.spec
server/src/muse_server_connection.c
server/src/muse_server_ipc.c
server/src/muse_server_private.c

index 2707e1b8e27014ac8f007fabe696201ad5c01e48..87bb0b90c16613792be7ee68213886fa7b5a3125 100644 (file)
@@ -677,7 +677,7 @@ bool muse_core_msg_recv_len(int fd, char *buf, int msg_len)
                        LOGE("[fd %d] recv failed [error %s %d]", fd, err_msg, errno);
                        return false;
                } else if (recv_len == 0) {
-                       LOGD("EOF");
+                       LOGD("[fd %d] EOF", fd);
                        return false;
                }
 
index 48c7f8ba754283de38388e985281b2e016a31a90..1b004dd704f5eab05b12bd707affffc674abe33b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.116
+Version:    0.3.117
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 78712fa7b02003371df49fdf28f49b42c8d226ff..3972079d8e98518d94525d4fbfee65f5df2a88fa 100644 (file)
@@ -61,7 +61,7 @@ static void _ms_connection_module_instance_info(muse_module_h m, ms_connection_t
 
        g_async_queue_push(ms->diag.msg_aq, (gpointer)dm);
 
-       LOGW("total number of modules = %d ( %s) - %s %p from pid %d %s client (count %d)",
+       LOGW("total number of modules = %d ( %s) - %s module %p from pid %d %s client (count %d)",
                len, ms->instance_pid_info, ms_get_command_string(cmd), m, m->pid,
                ms_config_get_host_name(m->idx), connection->instance_count[m->idx]);
 }
index 358ec1363f25fb33c3861f5eb3b58283043c655f..6d82a9c26ce46dab4f9efb92461d0a2319ef472d 100644 (file)
@@ -88,7 +88,7 @@ static void _ms_ipc_module_msg_ch_cleanup(muse_module_h m)
        SECURE_LOGD("[close] [%d] MUSE_CHANNEL_MSG %p", m->ch[MUSE_CHANNEL_MSG].sock_fd, m);
        muse_core_connection_close(m->ch[MUSE_CHANNEL_MSG].sock_fd);
 
-       SECURE_LOGD("%p thread exit", m->ch[MUSE_CHANNEL_MSG].thread);
+       SECURE_LOGD("msg thread (%p) exit", m->ch[MUSE_CHANNEL_MSG].thread);
        g_thread_unref(m->ch[MUSE_CHANNEL_MSG].thread);
        m->ch[MUSE_CHANNEL_MSG].thread = NULL;
 }
@@ -240,7 +240,7 @@ static gboolean _ms_ipc_dispatch_no_instance(muse_module_h m, void *jobj)
 out:
        ms_module_dispatch_unlock(m);
 
-       return FALSE;
+       return TRUE;
 }
 
 static gpointer _ms_ipc_dispatch_worker(gpointer data)
@@ -287,11 +287,11 @@ static gpointer _ms_ipc_dispatch_worker(gpointer data)
                        if (muse_core_msg_object_get_value(MSG_KEY_API, jobj, MUSE_TYPE_INT, &m->api)) {
                                switch (m->api) {
                                case API_CREATE:
-                                       SECURE_LOGI("CREATE %p %d", m, fd);
+                                       SECURE_LOGI("CREATE module %p %d", m, fd);
                                        attempt_to_dispatch = _ms_ipc_dispatch_create(m, jobj);
                                        break;
                                case API_DESTROY:
-                                       SECURE_LOGI("DESTROY %p %d", m, fd);
+                                       SECURE_LOGI("DESTROY module %p %d", m, fd);
                                        attempt_to_dispatch = _ms_ipc_dispatch_destroy(m);
                                        break;
                                default:
index 9bcf22b5ba89a75a4352c19e7a509eb086fbfb65..666ac60ca500eb04654cb1713bf354b4b71ba2b7 100644 (file)
@@ -265,6 +265,8 @@ static gboolean _ms_connection_handler(GIOChannel *source, GIOCondition conditio
        GQueue *instance_queue = NULL;
        ms_connection_t *connection = NULL;
 
+       muse_return_val_if_fail(channel == MUSE_CHANNEL_MSG || channel == MUSE_CHANNEL_DATA, FALSE);
+
        LOGI("Enter [%s channel]", channel_name[channel]);
 
        muse_return_val_if_fail(muse_server, FALSE);
@@ -309,6 +311,7 @@ static gboolean _ms_connection_handler(GIOChannel *source, GIOCondition conditio
 
        if (channel == MUSE_CHANNEL_MSG) {
                m = g_new0(muse_module_t, 1);
+               SECURE_LOGI("module [%p]", m);
                m->ch[MUSE_CHANNEL_MSG].sock_fd = client_sockfd;
                m->pid = pid;
                g_mutex_init(&m->dispatch_lock);
@@ -1271,7 +1274,7 @@ void ms_cmd_dispatch_foreach_func(gpointer data, gpointer user_data)
        }
 
        ms_cmd_dispatch(m, cmd);
-       SECURE_LOGI("[%s] %p (%s)", module_cmd[cmd], m, muse_server->conf->host[m->idx]);
+       SECURE_LOGI("[%s] module %p (%s)", module_cmd[cmd], m, muse_server->conf->host[m->idx]);
 
        if (cmd == MUSE_MODULE_COMMAND_EXTERNAL_STORAGE_STATE_CHANGED)
                muse_server_set_user_data(m, NULL);