From b3ceefb00b997a50a3da4288b6af3a56f89385c3 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Wed, 7 Feb 2018 14:46:11 +0900 Subject: [SATIZENVUL-1315/SATIZENVUL-1316] Remove msg size from thumbMsg Change-Id: Iaae0d5707294314a1bf856857521f95fb8582691 Signed-off-by: Minje Ahn --- server/thumb-server-internal.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'server/thumb-server-internal.c') diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c index 2f85b30..9116c05 100755 --- a/server/thumb-server-internal.c +++ b/server/thumb-server-internal.c @@ -126,33 +126,29 @@ gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpoi res_msg.msg_type = recv_msg.msg_type; res_msg.request_id = recv_msg.request_id; SAFE_STRLCPY(res_msg.org_path, recv_msg.org_path, sizeof(res_msg.org_path)); - res_msg.origin_path_size = recv_msg.origin_path_size; - if (res_msg.msg_type != THUMB_RESPONSE_RAW_DATA) { - res_msg.dest_path_size = strlen(res_msg.dst_path)+1; + if (res_msg.msg_type != THUMB_RESPONSE_RAW_DATA) res_msg.thumb_size = 0; - } else { - res_msg.dest_path_size = 1; + else res_msg.dst_path[0] = '\0'; - } int buf_size = 0; int sending_block = 0; - int block_size = sizeof(res_msg) - MAX_FILEPATH_LEN * 2 - sizeof(unsigned char *); + int block_size = sizeof(res_msg) - sizeof(unsigned char *); unsigned char *buf = NULL; _media_thumb_set_buffer(&res_msg, &buf, &buf_size); while (buf_size > 0) { - if (buf_size < THUMB_BLOCK_SIZE) { + if (buf_size < THUMB_BLOCK_SIZE) block_size = buf_size; - } + if (send(client_sock, buf+sending_block, block_size, 0) != block_size) { thumb_stderror("sendto failed"); + break; } sending_block += block_size; buf_size -= block_size; - if (block_size < THUMB_BLOCK_SIZE) { + if (block_size < THUMB_BLOCK_SIZE) block_size = THUMB_BLOCK_SIZE; - } } thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path); @@ -210,7 +206,7 @@ static gboolean __thumb_server_send_msg_to_agent(int msg_type) static gboolean _thumb_server_send_deny_message(int sockfd) { thumbMsg msg = {0}; - int bytes_to_send = sizeof(msg) - sizeof(msg.org_path) - sizeof(msg.dst_path); + int bytes_to_send = sizeof(msg); msg.msg_type = THUMB_RESPONSE; msg.status = MS_MEDIA_ERR_PERMISSION_DENIED; -- cgit v1.2.3