diff options
Diffstat (limited to 'src/ipc/media-thumb-ipc.c')
-rwxr-xr-x | src/ipc/media-thumb-ipc.c | 62 |
1 files changed, 6 insertions, 56 deletions
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c index 9064a7b..6b63959 100755 --- a/src/ipc/media-thumb-ipc.c +++ b/src/ipc/media-thumb-ipc.c @@ -117,7 +117,7 @@ void __media_thumb_shutdown_channel(bool only_shutdown) } } -int __media_thumb_pop_req_queue(const char *path) +int __media_thumb_pop_req_queue() { int req_len = 0; @@ -380,8 +380,7 @@ bool __media_thumb_check_cancel_for_raw(void) } } -int -_media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg) +int _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg) { int recv_msg_len = 0; int remain_size = 0; @@ -460,51 +459,7 @@ _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg) return MS_MEDIA_ERR_NONE; } -int -_media_thumb_recv_udp_msg(int sock, int header_size, thumbMsg *msg, struct sockaddr_un *from_addr, unsigned int *from_size) -{ - int recv_msg_len = 0; - unsigned int from_addr_size = sizeof(struct sockaddr_un); - unsigned char *buf = NULL; - - THUMB_MALLOC(buf, sizeof(thumbMsg)); - if (buf == NULL) { - thumb_err("memory allocation failed"); - return MS_MEDIA_ERR_OUT_OF_MEMORY; - } - - if ((recv_msg_len = recvfrom(sock, buf, sizeof(thumbMsg), 0, (struct sockaddr *)from_addr, &from_addr_size)) < 0) { - thumb_stderror("recvform failed"); - SAFE_FREE(buf); - return _media_thumb_get_error(); - } - - memcpy(msg, buf, header_size); - - if (msg->origin_path_size <= 0 || msg->origin_path_size > MAX_PATH_SIZE) { - SAFE_FREE(buf); - thumb_err("msg->origin_path_size is invalid %d", msg->origin_path_size); - return MS_MEDIA_ERR_INVALID_PARAMETER; - } - - SAFE_STRLCPY(msg->org_path, (char*)buf + header_size, sizeof(msg->org_path)); - - if (msg->dest_path_size <= 0 || msg->dest_path_size > MAX_PATH_SIZE) { - SAFE_FREE(buf); - thumb_err("msg->origin_path_size is invalid %d", msg->dest_path_size); - return MS_MEDIA_ERR_INVALID_PARAMETER; - } - - SAFE_STRLCPY(msg->dst_path, (char*)buf + header_size + msg->origin_path_size, sizeof(msg->dst_path)); - - SAFE_FREE(buf); - *from_size = from_addr_size; - - return MS_MEDIA_ERR_NONE; -} - -int -_media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size) +int _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size) { if (req_msg == NULL || buf == NULL) { return MS_MEDIA_ERR_INVALID_PARAMETER; @@ -540,8 +495,7 @@ _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size) return MS_MEDIA_ERR_NONE; } -int -_media_thumb_request(int msg_type, const char *origin_path, char *thumb_path, int max_length, uid_t uid) +int _media_thumb_request(int msg_type, const char *origin_path, char *thumb_path, int max_length, uid_t uid) { int sock = -1; struct sockaddr_un serv_addr; @@ -653,11 +607,7 @@ gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpoi if ((err = _media_thumb_recv_msg(sock, header_size, &recv_msg)) < 0) { thumb_err("_media_thumb_recv_msg failed "); - if (recv_msg.origin_path_size > 0) { - __media_thumb_pop_req_queue(recv_msg.org_path); - } else { - thumb_err("origin path size is wrong."); - } + __media_thumb_pop_req_queue(); return FALSE; } @@ -675,7 +625,7 @@ gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpoi } } - __media_thumb_pop_req_queue(recv_msg.org_path); + __media_thumb_pop_req_queue(); thumb_dbg("Done"); |