static void ***func_array;
static int lib_num;
static void **func_handle = NULL; /*dlopen handel*/
-int insert_count_for_partial = 0;
-int set_count_for_partial = 0;
static int scan_other_type = -1;
enum func_list {
ret = ms_scan_item_batch(handle, storage_id, path, uid);
if (ret != 0)
res = MS_MEDIA_ERR_DB_INSERT_FAIL;
- else
- insert_count_for_partial++;
} else {
if (modified == FALSE) {
/*if meta data of file exist, change valid field to "1" */
MS_DBG_ERR("error : %s [%s] %s", g_array_index(so_array, char*, lib_index), err_msg, path);
MS_SAFE_FREE(err_msg);
res = MS_MEDIA_ERR_DB_UPDATE_FAIL;
- } else {
- set_count_for_partial++;
}
} else {
/* the file has same name but it is changed, so we have to update DB */
ret = ms_scan_item_batch(handle, storage_id, path, uid);
if (ret != 0)
res = MS_MEDIA_ERR_DB_INSERT_FAIL;
- else
- insert_count_for_partial++;
}
}
}
malloc_trim(0);
if (extract_data->result) {
+ MS_DBG_ERR("MS_MSG_SCANNER_COMPLETE");
if (noti_type == MS_ITEM_INSERT || noti_type == MS_ITEM_UPDATE) {
/*send notification*/
char *folder_uuid = NULL;
}
extract_data->msg_type = MS_MSG_EXTRACTOR_COMPLETE;
msc_send_result(ret, extract_data);
+ } else {
+ MS_DBG_ERR("MS_MSG_SCANNER_PARTIAL");
+ msc_send_result_partial(ret, MS_MSG_SCANNER_PARTIAL, extract_data->pid, extract_data->msg);
}
MS_SAFE_FREE(update_path);
s_scan_item* cancel_scan_item = NULL;
s_scan_item* cur_scan_item = NULL;
-extern int insert_count_for_partial;
-extern int set_count_for_partial;
int g_directory_scan_processing2 = DIR_SCAN_NON_SCAN;
char *g_storage_scan_path;
char* g_dir_scan_path;
const char *trash = "$RECYCLE.BIN";
- insert_count_for_partial = 0;
- set_count_for_partial = 0;
MS_DBG_WARN("storage id [%s] start path [%s]", storage_id, start_path);
/* insert into media DB */
ret = ms_scan_validate_item(handle, storage_id, path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("failed to update db : %d", scan_type);
+ MS_DBG_ERR("failed to update db : %d", ret);
if (ret == MS_MEDIA_ERR_FILE_IO)
MS_DBG_ERR("I/O ERROR COUNT[%d]", io_err_folder++);
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) {
- if (pid != 0)
- msc_send_result_partial(ret, MS_MSG_SCANNER_PARTIAL, pid, (char*)start_path);
- insert_count_for_partial = 0;
- }
- if (set_count_for_partial >= MAX_SCAN_COUNT) {
- if (pid != 0)
- msc_send_result_partial(ret, MS_MSG_SCANNER_PARTIAL, pid, (char*)start_path);
- set_count_for_partial = 0;
}
}
} else if (d->d_type == DT_DIR) {
int scan_type;
char *storage_id = NULL;
bool modified = FALSE;
- int index = 0;
ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
ms_dir_scan_status_e scan_status = MS_DIR_SCAN_NONE;
ms_noti_type_e noti_type = MS_ITEM_INSERT;
if (ret != MS_MEDIA_ERR_NONE)
goto NEXT;
- if ((++index) % 3 == 0)
- msc_send_result_partial(ret, MS_MSG_SCANNER_PARTIAL, scan_data->pid, scan_data->msg);
err = __msc_check_scan_same_path(scan_data->msg);
if (err != MS_MEDIA_ERR_NONE)
break;
}
- index = 0;
MS_DBG_WARN("[%s] scan done, wait finished", scan_data->msg);
goto SCAN_DONE;
if (ret != MS_MEDIA_ERR_NONE)
goto NEXT;
- if ((++index) % 3 == 0)
- msc_send_result_partial(ret, MS_MSG_SCANNER_PARTIAL, scan_data->pid, scan_data->msg);
ms_get_folder_scan_status(handle, storage_id, scan_data->msg, (int*)&scan_status);
if ((scan_status == MS_DIR_SCAN_DONE) || (scan_status == MS_DIR_SCAN_STOP)) {
}
}
- index = 0;
if (scan_status == MS_DIR_SCAN_DONE) {
MS_DBG_WARN("[%s] scan done, wait finished", scan_data->msg);
goto SCAN_DONE;
#include "media-scanner-scan-v2.h"
#include "media-scanner-socket-v2.h"
#include "media-scanner-extract-v2.h"
+#define SUPPORT_PARTIAL_EVENT
extern GAsyncQueue *storage_queue2;
extern GAsyncQueue *scan_queue2;
extern GMutex scan_req_mutex2;
extern GAsyncQueue *folder_extract_queue;
extern int g_directory_scan_processing2;
-//#define SUPPORT_PARTIAL_EVENT
+
static int _msc_remove_request(GAsyncQueue *req_queue, ms_comm_msg_s *recv_msg)
{
char *cancel_path = recv_msg->msg;
return res;
}
-/* define of SUPPORT_PARTIAL_EVENT is disabled, send partial result will not be active */
+/* define of SUPPORT_PARTIAL_EVENT is disabled, send partial result will not be active */
int msc_send_result_partial(int result, ms_msg_type_e msg_type, int pid, const char *msg)
{
#ifdef SUPPORT_PARTIAL_EVENT
- MS_DBG_SLOG("msc_send_result msg_type=%d", msg_type);
+ MS_DBG_SLOG("msc_send_result_partial %d,%d,%s", msg_type, pid, msg);
int res = MS_MEDIA_ERR_NONE;
ms_comm_msg_s send_msg;
int fd = -1;
MS_DBG_ERR("res_path is NULL");
return MS_MEDIA_ERR_OUT_OF_MEMORY;
}
-
+ if (recv_msg->msg_type == MS_MSG_SCANNER_PARTIAL) {
+ ms_req_owner_data *data = NULL;
+ int len = owner_list->len;
+ 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);
+ }
+ MS_SAFE_FREE(res_path);
+ } else {
__ms_find_owner(pid, res_path, &owner_data);
if (owner_data != NULL) {
- MS_DBG("PID : %d", owner_data->pid);
/* owner data exists */
/* send result to the owner of request */
ms_ipc_send_msg_to_client_tcp(owner_data->client_sockfd, recv_msg, NULL);
- MS_DBG("add handle MS_MSG_SCANNER_PARTIAL message");
- if ((recv_msg->msg_type != MS_MSG_SCANNER_COMPLETE) && (recv_msg->msg_type != MS_MSG_SCANNER_PARTIAL))
+ MS_DBG_ERR("OTHER message: pid %d, path %s", owner_data->pid, owner_data->req_path);
+ if ((recv_msg->msg_type != MS_MSG_SCANNER_COMPLETE) && (recv_msg->msg_type != MS_MSG_SCANNER_PARTIAL)) {
close(owner_data->client_sockfd);
+ }
MS_SAFE_FREE(res_path);
MS_DBG_ERR("Not found Owner");
MS_SAFE_FREE(res_path);
return MS_MEDIA_ERR_INTERNAL;
+ }
}
} else {
/* owner data does not exist*/