refine cancel folder scan could not stop 49/159649/4 accepted/tizen/unified/20171117.060151 submit/tizen/20171114.053103 submit/tizen/20171116.015353 submit/tizen/20171116.082651
authorchen89.chen <chen89.chen@samsung.com>
Fri, 10 Nov 2017 09:38:07 +0000 (17:38 +0800)
committerchen89.chen <chen89.chen@samsung.com>
Tue, 14 Nov 2017 04:21:24 +0000 (12:21 +0800)
Change-Id: If2c138e3d13c0fd9fd16af75c0f740b8e98919b2

src/scanner-v2/media-scanner-scan-v2.c
src/scanner-v2/media-scanner-socket-v2.c

index 173bb9e..ddddb40 100755 (executable)
@@ -489,7 +489,14 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons
                                                if (scan_count >= MAX_SCAN_COUNT) {
                                                        scan_count = 0;
                                                        //MS_DBG_ERR("storage_id = [%s]", storage_id);
-                                                       msc_insert_exactor_request(scan_type, FALSE, storage_id, current_path, 0, uid);
+                                                       ret = __msc_check_stop_status(scan_type, storage_type, new_start_path, pid);
+                                                       if (ret == MS_MEDIA_ERR_NONE) {
+                                                               msc_insert_exactor_request(scan_type, FALSE, storage_id, current_path, pid, uid);
+                                                       } else {
+                                                               if (is_recursive == true)
+                                                                       ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid);
+                                                               goto STOP_SCAN;
+                                                       }
                                                }
 
                                                if (insert_count_for_partial >= MAX_SCAN_COUNT) {
@@ -1270,9 +1277,10 @@ gboolean msc_directory_scan_thread(void *data)
                }*/
 
 SCAN_DONE:
-               MS_DBG_WARN("storage_id = [%s], dir Path = [%s]", storage_id, scan_data->msg);
-               msc_insert_exactor_request(scan_data->msg_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid);
-
+               MS_DBG_WARN("storage_id = [%s], dir Path = [%s], pid = [%d]", storage_id, scan_data->msg, scan_data->pid);
+               if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
+                       msc_insert_exactor_request(scan_data->msg_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid);
+               }
                if (power_off2) {
                        MS_DBG_ERR("power off");
                        goto _POWEROFF;
index 2880034..641882e 100755 (executable)
@@ -58,10 +58,9 @@ static int _msc_remove_request(GAsyncQueue *req_queue, ms_comm_msg_s *recv_msg)
                goto END_REMOVE_REQUEST;
        }
 
-       MS_DBG_WARN("len == [%d]", len);
+       MS_DBG_WARN("len == [%d] pid=[%d], cancel_path[%s]", len, pid, cancel_path);
 
        msc_set_cancel_scan_item(recv_msg->msg, recv_msg->pid);
-       msc_set_cancel_extract_item(recv_msg->msg, recv_msg->pid);
 
        if (len > 0) {
                temp_scan_queue = g_async_queue_new();
@@ -93,6 +92,7 @@ static int _msc_remove_request(GAsyncQueue *req_queue, ms_comm_msg_s *recv_msg)
 
 END_REMOVE_REQUEST:
        {
+               msc_set_cancel_extract_item(recv_msg->msg, recv_msg->pid);
                GAsyncQueue *temp_extract_queue = NULL;
                int len_extract = g_async_queue_length(folder_extract_queue);
                MS_DBG_WARN("len [%d]", len_extract);