req_result.pid = recv_msg.pid;
req_result.result = recv_msg.result;
+
if (recv_msg.msg_type == MS_MSG_SCANNER_RESULT) {
req_result.complete_path = strndup(recv_msg.msg, recv_msg.msg_size);
req_result.request_type = MEDIA_DIRECTORY_SCAN;
user_data = ((media_callback_data *)data)->user_data;
sock_path = ((media_callback_data *)data)->sock_path;
- /*call user define function*/
- user_callback(&req_result, user_data);
-
if ((recv_msg.msg_type != MS_MSG_SCANNER_COMPLETE) &&
(recv_msg.msg_type != MS_MSG_SCANNER_PARTIAL) &&
req_result.complete_path != NULL) {
for (i = 0; i < list_len; i++) {
req_data = g_array_index(req_list, media_scan_data*, i);
- if (strcmp(req_data->req_path, req_result.complete_path) == 0) {
+ if (req_data != NULL && g_strcmp0(req_data->req_path, req_result.complete_path) == 0) {
MSAPI_DBG("FIND REQUEST [%s]", req_data->req_path);
g_array_remove_index(req_list, i);
+ /*call user define function*/
+ req_data->cb_data->user_callback(&req_result, user_data);
+
/*close an IO channel*/
g_io_channel_shutdown(src, FALSE, NULL);
g_io_channel_unref(src);
}
g_mutex_unlock(&scan_req_mutex);
MS_SAFE_FREE(data);
+ } else {
+ /*call user define function. Scanner V2 case only*/
+ user_callback(&req_result, user_data);
}
MS_SAFE_FREE(req_result.complete_path);
user_data = ((media_callback_data *)cb_data)->user_data;
/*call user define function*/
+ MSAPI_DBG("Call Cancel Callback");
user_callback(&req_result, user_data);
/*close an IO channel*/
break;
}
+ }
- if (flag == false) {
- MSAPI_DBG("Not in scan queue :%s", req_path);
- g_mutex_unlock(&scan_req_mutex);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
+ if (flag == false) {
+ MSAPI_DBG("Not in scan queue :%s", req_path);
+ g_mutex_unlock(&scan_req_mutex);
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
}
g_mutex_unlock(&scan_req_mutex);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- MSAPI_DBG("REQUEST DIRECTORY SCANNING[%s]", request_msg);
+ MSAPI_DBG("REQUEST UPDATE ASYNC [%d][%s]", msg_type, request_msg);
request_msg_size = strlen(request_msg);
if (request_msg_size >= MAX_MSG_SIZE) {