request continuously with same pid and request path, cancel request force stop will be sent
commit to db before set scan done, fix timing issue
previously extract blocked path was not deleted, remove extract queue and delete extract block path when usb umount
Change-Id: Icd42b6268919f4195c55bc9dc5a6152cc2a2548f
if (scan_type != MS_MSG_STORAGE_ALL
&& scan_type != MS_MSG_STORAGE_PARTIAL) {
MS_DBG_ERR("Invalid request[%d]", scan_type);
+ msc_remove_extract_request(extract_data);
ret = MS_MEDIA_ERR_INVALID_PARAMETER;
goto NEXT;
}
/* set vconf key db extract status */
__msc_extract_set_db_status(MS_DB_STOPPED);
- msc_del_extract_blocked_path(update_path);
msc_remove_extract_request(extract_data);
goto STOP_DISC;
}
if (extract_data->result == TRUE) {
MS_DBG_WARN("extract_data->result == TRUE, MS_STORAGE_SCAN_COMPLETE");
+ msc_del_extract_blocked_path(update_path);
ms_set_storage_scan_status(handle, extract_data->storage_id, MEDIA_EXTRACT_COMPLETE, uid);
__msc_set_storage_extract_status(MS_STORAGE_SCAN_COMPLETE);
END_REMOVE_REQUEST:
g_mutex_unlock(&extract_req_mutex);
MS_DBG_WARN("exactor_req_mutex is UNLOCKED");
+ msc_del_extract_blocked_path(recv_msg->msg);
return MS_MEDIA_ERR_NONE;
}
}
g_extract_blocked_path = strdup(blocked_path);
-
+ MS_DBG_ERR("g_extract_blocked_path is set [%s]", g_extract_blocked_path);
g_mutex_unlock(&extract_blocked_mutex);
MS_DBG_FLEAVE();
g_mutex_lock(&extract_blocked_mutex);
if (blocked_path) {
- if (g_extract_blocked_path && (0 == strncmp(blocked_path, g_extract_blocked_path, strlen(blocked_path)))) {
- MS_DBG_ERR("g_extract_blocked_path is not NULL [%s]", g_extract_blocked_path);
+ if (g_extract_blocked_path && (0 == strncmp(blocked_path, g_extract_blocked_path, strlen(g_extract_blocked_path)))) {
+ MS_DBG_ERR("g_extract_blocked_path is deleted [%s]", g_extract_blocked_path);
MS_SAFE_FREE(g_extract_blocked_path);
}
} else {
if (g_extract_blocked_path != NULL) {
- MS_DBG_ERR("g_extract_blocked_path is not NULL [%s]", g_extract_blocked_path);
+ MS_DBG_ERR("g_extract_blocked_path is deleted [%s]", g_extract_blocked_path);
MS_SAFE_FREE(g_extract_blocked_path);
}
}
scan_function = (scan_type == MS_MSG_STORAGE_ALL) ? ms_scan_item_batch : ms_scan_validate_item;
+ ms_bacth_commit_disable(handle, TRUE, TRUE, uid);
/*start db update. the number of element in the array , db update is complete.*/
while (dir_array->len != 0) {
/*check poweroff status*/
if (ret != MS_MEDIA_ERR_NONE)
goto STOP_SCAN;
- ms_bacth_commit_disable(handle, TRUE, TRUE, uid);
+ /*ms_bacth_commit_disable(handle, TRUE, TRUE, uid);*/
ms_bacth_commit_enable(handle, TRUE, TRUE, MS_NOTI_SWITCH_OFF, pid);
/* get the current path from directory array */
}
ms_insert_folder_end(handle, uid);
+ /*commit to db before set scan done, fix timing issue storage scan, then folder scan for same folder*/
+ ms_bacth_commit_disable(handle, TRUE, TRUE, uid);
ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid);
if (fd != -1) {
MS_DBG_WARN("cancel_path[%s], pid[%d]", cancel_path, pid);
if ((strcmp(cur_scan_item->path, cancel_path) == 0) && (pid == cur_scan_item->pid))
ret = _msc_set_scan_item(&cancel_scan_item, cancel_path, pid);
-
+ else if ((pid == -1) && (strncmp(cur_scan_item->path, cancel_path, strlen(cancel_path)) == 0))
+ ret = _msc_set_scan_item(&cancel_scan_item, cancel_path, pid);
} else {
MS_DBG_ERR("cur_scan_item == NULL || cur_scan_item->path == NULL");
}
{
MS_DBG_SLOG("msc_send_result msg_type=%d", res_data->msg_type);
int res = MS_MEDIA_ERR_NONE;
+
+ if (result == MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
+ MS_DBG_WARN("msc_send_result -701 will not be sent");
+ return res;
+ }
ms_comm_msg_s send_msg;
int fd = -1;
int err = -1;
#ifdef SUPPORT_PARTIAL_EVENT
MS_DBG_SLOG("msc_send_result_partial %d,%d,%s", msg_type, pid, msg);
int res = MS_MEDIA_ERR_NONE;
+
+ /*in case of request continuously with same pid and request path, cancel request force stop will be sent*/
+ if (result == MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
+ MS_DBG_WARN("msc_send_result_partial -701 will not be sent");
+ return res;
+ }
ms_comm_msg_s send_msg;
int fd = -1;
int err = -1;
MS_DBG_ERR("length list : %d", len);
for (int i = 0; i < len; i++) {
data = g_array_index(owner_list, ms_req_owner_data*, i);
- MS_DBG_ERR("PARTIAL message:pid %d,path %s", data->pid, data->req_path);
- ms_ipc_send_msg_to_client_tcp(data->client_sockfd, recv_msg, NULL);
+ /*send partial message to all request pid, need to check path*/
+ if (strcmp(data->req_path, res_path) == 0) {
+ MS_DBG_ERR("PARTIAL message:pid %d,path %s", data->pid, data->req_path);
+ ms_ipc_send_msg_to_client_tcp(data->client_sockfd, recv_msg, NULL);
+ }
}
MS_SAFE_FREE(res_path);
} else {