summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2018-08-16 05:08:07 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2018-08-16 06:40:43 (GMT)
commit502897884409c420868f6d5ed59c6b807860d362 (patch)
treeb0f1e3c1f5d0cd144eb826ab08164c6d09df1587 /server
parent60cb59fe31c8e61be1918d2749810aa36b885be3 (diff)
downloadlibmedia-thumbnail-502897884409c420868f6d5ed59c6b807860d362.zip
libmedia-thumbnail-502897884409c420868f6d5ed59c6b807860d362.tar.gz
libmedia-thumbnail-502897884409c420868f6d5ed59c6b807860d362.tar.bz2
Change-Id: I28a1445463df8dc6ac6fb18fb1a2d395913d8264 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'server')
-rwxr-xr-xserver/thumb-server-internal.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 32fd5a3..287a3da 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -37,7 +37,6 @@
#define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
#define THUMB_DEFAULT_WIDTH 320
#define THUMB_DEFAULT_HEIGHT 240
-#define THUMB_BLOCK_SIZE 10240
#define THUMB_COMM_SOCK_PATH tzplatform_mkpath(TZ_SYS_RUN, "media-server/media_ipc_thumbcomm.socket")
#define THUMB_EMPTY_STR ""
@@ -136,23 +135,18 @@ gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpoi
res_msg.dst_path[0] = '\0';
int buf_size = 0;
- int sending_block = 0;
- int block_size = sizeof(res_msg) - sizeof(unsigned char *);
+ int send_len = 0;
+ int send_pos = 0;
unsigned char *buf = NULL;
_media_thumb_set_buffer(&res_msg, &buf, &buf_size);
while (buf_size > 0) {
- if (buf_size < THUMB_BLOCK_SIZE)
- block_size = buf_size;
-
- if (send(client_sock, buf+sending_block, block_size, 0) < 0) {
+ if ((send_len = send(client_sock, buf + send_pos, buf_size, 0)) < 0) {
thumb_stderror("send failed");
+ break;
}
-
- sending_block += block_size;
- buf_size -= block_size;
- if (block_size < THUMB_BLOCK_SIZE)
- block_size = THUMB_BLOCK_SIZE;
+ send_pos += send_len;
+ buf_size -= send_len;
}
SAFE_FREE(buf);