send msg to app side when recursive scan start 70/219670/1 accepted/tizen/unified/20191211.121126 submit/tizen/20191209.064142
authorchengyj1985 <yujie.cheng@samsung.com>
Mon, 9 Dec 2019 06:13:52 +0000 (14:13 +0800)
committerchengyj1985 <yujie.cheng@samsung.com>
Mon, 9 Dec 2019 06:13:52 +0000 (14:13 +0800)
Change-Id: I1c8d0832ba6dbce5721f44c0f9e2f545b75e9910

lib/include/media-server-ipc.h
lib/include/media-util-register.h
lib/media-util-register.c
src/scanner-v2/media-scanner-scan-v2.c
src/scanner-v2/media-scanner-socket-v2.c
src/server/media-server-socket.c

index a1046e4..1393da3 100755 (executable)
@@ -62,6 +62,7 @@ typedef enum {
        MS_MSG_SCANNER_PARTIAL,
        MS_MSG_SCANNER_COMPLETE,
        MS_MSG_EXTRACTOR_COMPLETE,
+       MS_MSG_RECURSIVE_START,
        MS_MSG_MEDIA_DB_RESET,  /**< media DB is reset*/
        MS_MSG_MEDIA_DB_MALFORMED,
        MS_MSG_MAX                                                      /**< Invalid msg type */
index 8c63b18..4ff1909 100755 (executable)
@@ -36,6 +36,7 @@ typedef enum {
        MEDIA_REQUEST_SCAN_PARTIAL,
        MEDIA_REQUEST_SCAN_COMPLETE,
        MEDIA_REQUEST_EXTRACT_COMPLETE,
+       MEDIA_RECURSIVE_START,
 } media_request_type_e;
 
 typedef struct {
index c3f1c8c..2fa6ff4 100755 (executable)
@@ -114,6 +114,9 @@ gboolean _read_socket(GIOChannel *src, GIOCondition condition, gpointer data)
        case MS_MSG_SCANNER_PARTIAL:
                req_result.request_type = MEDIA_REQUEST_SCAN_PARTIAL;
                break;
+       case MS_MSG_RECURSIVE_START:
+               req_result.request_type = MEDIA_RECURSIVE_START;
+               break;
        case MS_MSG_EXTRACTOR_COMPLETE:
                req_result.request_type = MEDIA_REQUEST_EXTRACT_COMPLETE;
                break;
@@ -131,6 +134,7 @@ gboolean _read_socket(GIOChannel *src, GIOCondition condition, gpointer data)
 
        if ((recv_msg.msg_type != MS_MSG_SCANNER_COMPLETE) &&
        (recv_msg.msg_type != MS_MSG_SCANNER_PARTIAL) &&
+       (recv_msg.msg_type != MS_MSG_RECURSIVE_START) &&
        req_result.complete_path != NULL) {
                /*NEED MUTEX*/
                g_mutex_lock(&scan_req_mutex);
index 46fdad5..1c4d714 100644 (file)
@@ -1185,7 +1185,7 @@ gboolean msc_directory_scan_thread(void *data)
 
                        if (MS_MEDIA_ERR_NONE == err) {
                                MS_DBG_WARN("[%.*s] is scanning recursive, waiting...", MAX_MSG_SIZE, scan_data->msg);
-
+                               msc_send_result_partial(ret, MS_MSG_RECURSIVE_START, scan_data->pid, scan_data->msg);
                                while (1) {
                                        sleep(1);
 
@@ -1209,6 +1209,8 @@ gboolean msc_directory_scan_thread(void *data)
                                        ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_VALID_V2, MS_RECURSIVE, uid);
                                else
                                        ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_INVALID, MS_RECURSIVE, uid);
+
+                               msc_send_result_partial(ret, MS_MSG_RECURSIVE_START, scan_data->pid, scan_data->msg);
                        }
                } else {
                        MS_DBG_WARN("start non recursive dir scan!!");
index 0e2119e..f8d10fc 100755 (executable)
@@ -319,7 +319,7 @@ int msc_send_result_partial(int result, ms_msg_type_e msg_type, int pid, const c
 
        /* send result message */
        memset(&send_msg, 0x0, sizeof(ms_comm_msg_s));
-       send_msg.msg_type = MS_MSG_SCANNER_PARTIAL;
+       send_msg.msg_type = msg_type;
        send_msg.pid = pid;
        send_msg.result = result;
        SAFE_STRLCPY(send_msg.msg, msg, sizeof(send_msg.msg));
index f914bb7..ecac267 100644 (file)
@@ -155,7 +155,7 @@ static int __ms_send_result_to_client(int pid, ms_comm_msg_s *recv_msg)
                        data = g_array_index(owner_list, ms_req_owner_data*, i);
                        if (data->pid == pid && strcmp(data->req_path, recv_msg->msg) == 0) {
                                ms_ipc_send_msg_to_client_tcp(data->client_sockfd, recv_msg, NULL);
-                               if (recv_msg->msg_type != MS_MSG_SCANNER_COMPLETE)
+                               if (recv_msg->msg_type != MS_MSG_SCANNER_COMPLETE && recv_msg->msg_type != MS_MSG_RECURSIVE_START)
                                        g_array_remove_index(owner_list, i);
 
                                break;
@@ -540,6 +540,7 @@ gboolean ms_receive_message_from_scanner(GIOChannel *src, GIOCondition condition
                break;
        case MS_MSG_SCANNER_PARTIAL:
        case MS_MSG_SCANNER_COMPLETE:
+       case MS_MSG_RECURSIVE_START:
                MS_DBG_WARN("DB UPDATING IS DONE[%d]", recv_msg.msg_type);
                break;
        default: