summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>2014-11-03 10:19:07 (GMT)
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>2014-12-05 13:09:35 (GMT)
commit0e0374b7ed2cd696418ba1c946afeaaa991e29f8 (patch)
tree45dcd675920e649ab2fe077fb9395b20bfad6361
parentf0be21988c9b0a4d165d386f8062a4bf2f5b095b (diff)
downloadlibmedia-thumbnail-0e0374b7ed2cd696418ba1c946afeaaa991e29f8.zip
libmedia-thumbnail-0e0374b7ed2cd696418ba1c946afeaaa991e29f8.tar.gz
libmedia-thumbnail-0e0374b7ed2cd696418ba1c946afeaaa991e29f8.tar.bz2
Use connected socket to communicate with CAPIrefs/changes/29/31529/1
Add credential option to get user UID from CAPI Bug-Tizen: TC-1598 Change-Id: Ib9bf7164a82766b29c2e13868e63d6bca64ea3c4 Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
-rwxr-xr-xserver/thumb-server-internal.c11
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c3
2 files changed, 11 insertions, 3 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 6de74ad..860bc6a 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -421,7 +421,7 @@ gboolean _thumb_server_send_msg_to_agent(int msg_type)
ms_thumb_server_msg send_msg;
#ifdef _USE_UDS_SOCKET_
- if (ms_ipc_create_client_socket(MS_PROTOCOL_UDP, MS_TIMEOUT_SEC_10, &sock, MS_THUMB_COMM_PORT) < 0) {
+ if (ms_ipc_create_client_socket(MS_PROTOCOL_TCP, MS_TIMEOUT_SEC_10, &sock, MS_THUMB_COMM_PORT) < 0) {
#else
if (ms_ipc_create_client_socket(MS_PROTOCOL_UDP, MS_TIMEOUT_SEC_10, &sock) < 0) {
#endif
@@ -441,7 +441,14 @@ gboolean _thumb_server_send_msg_to_agent(int msg_type)
send_msg.msg_type = msg_type;
- if (sendto(sock, &send_msg, sizeof(ms_thumb_server_msg), 0, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != sizeof(ms_thumb_server_msg)) {
+
+ if (connect(sock, &serv_addr, sizeof(serv_addr)) < 0) {
+ thumb_err("connect failed [%s]",strerror(errno));
+ close(sock);
+ return FALSE;
+ }
+
+ if (send(sock, &send_msg, sizeof(ms_thumb_server_msg), 0) != sizeof(ms_thumb_server_msg)) {
thumb_err("sendto failed: %s\n", strerror(errno));
close(sock);
return FALSE;
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index b8ec1a5..080a817 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -164,6 +164,7 @@ int __media_thumb_check_req_queue(const char *path)
{
int req_len = 0, i;
+ if (g_request_queue == NULL) return MEDIA_THUMB_ERROR_NONE;
req_len = g_queue_get_length(g_request_queue);
// thumb_dbg("Queue length : %d", req_len);
@@ -776,7 +777,7 @@ _media_thumb_request_async(int msg_type, media_thumb_type thumb_type, const char
#ifdef _USE_MEDIA_UTIL_
#ifdef _USE_UDS_SOCKET_
- strcpy(serv_addr.sun_path, "/tmp/media_ipc_thumbcreator.dat");
+ strcpy(serv_addr.sun_path, "/var/run/media-server/media_ipc_thumbcreator.socket");
#elif defined(_USE_UDS_SOCKET_TCP_)
strcpy(serv_addr.sun_path, "/tmp/media_ipc_thumbcreator.dat");
#else