summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorHyunjun Ko <zzoon.ko@samsung.com>2013-04-18 02:38:34 (GMT)
committerHyunjun Ko <zzoon.ko@samsung.com>2013-04-18 02:38:34 (GMT)
commit48a1a698783941011b472978302c44ab4b23b46f (patch)
treec2d68dd019c8889fa2b4fa91bea19724e9ddbafc /server
parent26b05feb5117117b1fb53545ef7cbe967beb7fbd (diff)
downloadlibmedia-thumbnail-48a1a698783941011b472978302c44ab4b23b46f.zip
libmedia-thumbnail-48a1a698783941011b472978302c44ab4b23b46f.tar.gz
libmedia-thumbnail-48a1a698783941011b472978302c44ab4b23b46f.tar.bz2
Diffstat (limited to 'server')
-rwxr-xr-xserver/thumb-server-internal.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 83f3186..0f3a949 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -297,7 +297,11 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
GIOCondition condition,
gpointer data)
{
+#ifdef _USE_UDS_SOCKET_
+ struct sockaddr_un client_addr;
+#else
struct sockaddr_in client_addr;
+#endif
unsigned int client_addr_len;
#ifndef _USE_MEDIA_UTIL_
int client_sock;
@@ -379,6 +383,9 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
close(client_sock);
#else
+#ifdef _USE_UDS_SOCKET_
+ thumb_dbg("+++++++++++++++++++++%s", client_addr.sun_path);
+#endif
if (sendto(sock, buf, buf_size, 0, (struct sockaddr *)&client_addr, sizeof(client_addr)) != buf_size) {
thumb_err("sendto failed: %s\n", strerror(errno));
SAFE_FREE(buf);
@@ -403,24 +410,31 @@ gboolean _thumb_server_send_msg_to_agent(int msg_type)
{
int sock;
const char *serv_ip = "127.0.0.1";
+#ifdef _USE_UDS_SOCKET_
+ struct sockaddr_un serv_addr;
+#else
struct sockaddr_in serv_addr;
- ms_thumb_server_msg send_msg;
-#if 0
- /* Creaete a UDP socket */
- if (_media_thumb_create_udp_socket(&sock) < 0) {
- thumb_err("_media_thumb_create_udp_socket failed");
- return FALSE;
- }
#endif
+ 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) {
+#else
if (ms_ipc_create_client_socket(MS_PROTOCOL_UDP, MS_TIMEOUT_SEC_10, &sock) < 0) {
+#endif
thumb_err("ms_ipc_create_server_socket failed");
return FALSE;
}
memset(&serv_addr, 0, sizeof(serv_addr));
+#ifdef _USE_UDS_SOCKET_
+ serv_addr.sun_family = AF_UNIX;
+ strcpy(serv_addr.sun_path, "/tmp/media_ipc_thumbcomm.dat");
+#else
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = inet_addr(serv_ip);
serv_addr.sin_port = htons(MS_THUMB_COMM_PORT);
+#endif
send_msg.msg_type = msg_type;
@@ -454,16 +468,13 @@ gboolean _thumb_server_prepare_socket(int *sock_fd)
thumb_err("ms_ipc_create_server_socket failed");
return FALSE;
}
-#if 0
- /* Creaete a UDP socket */
- if (_media_thumb_create_udp_socket(&sock) < 0) {
- thumb_err("_media_thumb_create_udp_socket failed");
- return FALSE;
- }
-#endif
#else
char thumb_path[MAX_PATH_SIZE + 1];
+#ifdef _USE_UDS_SOCKET_
+ struct sockaddr_un serv_addr;
+#else
struct sockaddr_in serv_addr;
+#endif
serv_port = THUMB_DAEMON_PORT;
/* Creaete a TCP socket */