diff options
author | Minje Ahn <minje.ahn@samsung.com> | 2017-05-22 18:19:19 +0900 |
---|---|---|
committer | Minje Ahn <minje.ahn@samsung.com> | 2017-05-23 10:19:49 +0900 |
commit | c313249d0ea2e2e923b07d9d5990c93c4c2aa3ea (patch) | |
tree | 5351e62d2cd252c692d9aac80de47045eb2402f0 | |
parent | 268e5bdd50fd57ba6bf393376571dd71ecc9c24e (diff) | |
download | media-controller-c313249d0ea2e2e923b07d9d5990c93c4c2aa3ea.tar.gz media-controller-c313249d0ea2e2e923b07d9d5990c93c4c2aa3ea.tar.bz2 media-controller-c313249d0ea2e2e923b07d9d5990c93c4c2aa3ea.zip |
Remove unused codesubmit/tizen/20170523.092712submit/tizen/20170523.042515accepted/tizen/unified/20170531.082429
Remove socket path and structure
Change-Id: I164d7537e7b1497ee1e1e450b118c37439f5cb5d
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-x | packaging/capi-media-controller.spec | 2 | ||||
-rwxr-xr-x | src/media_controller_ipc.c | 28 | ||||
-rwxr-xr-x | svc/include/media_controller_socket.h | 8 | ||||
-rwxr-xr-x | svc/media_controller_socket.c | 25 |
4 files changed, 18 insertions, 45 deletions
diff --git a/packaging/capi-media-controller.spec b/packaging/capi-media-controller.spec index 5d2ff2c..28e7af7 100755 --- a/packaging/capi-media-controller.spec +++ b/packaging/capi-media-controller.spec @@ -1,6 +1,6 @@ Name: capi-media-controller Summary: A media controller library in Tizen Native API -Version: 0.1.39 +Version: 0.1.40 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_controller_ipc.c b/src/media_controller_ipc.c index b8f0fc6..c34592f 100755 --- a/src/media_controller_ipc.c +++ b/src/media_controller_ipc.c @@ -292,7 +292,6 @@ int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, const int type, const int ret = MEDIA_CONTROLLER_ERROR_NONE; int request_msg_size = 0; int sockfd = -1; - mc_sock_info_s sock_info; struct sockaddr_un serv_addr; int retry_count = 0; @@ -320,8 +319,7 @@ int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, const int type, const MC_SAFE_STRLCPY(send_msg.msg, request_msg, sizeof(send_msg.msg)); /*Create Socket*/ - ret = mc_ipc_create_client_socket(MC_TIMEOUT_SEC_5, &sock_info); - sockfd = sock_info.sock_fd; + ret = mc_ipc_create_client_socket(MC_TIMEOUT_SEC_5, &sockfd); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "socket is not created properly"); /*Set server Address*/ @@ -332,7 +330,8 @@ int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, const int type, const /* Connecting to the media db server */ if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { mc_stderror("connect error"); - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); + if (errno == EACCES) return MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED; else @@ -342,7 +341,8 @@ int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, const int type, const /* Send request */ if (send(sockfd, &send_msg, sizeof(send_msg), 0) != sizeof(send_msg)) { mc_stderror("send failed"); - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); + return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } @@ -366,20 +366,21 @@ RETRY: goto RETRY; } - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); + mc_error("Timeout. Can't try any more"); return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } else { mc_stderror("recv failed"); - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); + return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } } mc_debug("RECEIVE OK [%d]", recv_msg); ret = recv_msg; - - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); return ret; } @@ -388,7 +389,6 @@ int mc_ipc_service_connect(const int type) { int ret = MEDIA_CONTROLLER_ERROR_NONE; int sockfd = -1; - mc_sock_info_s sock_info; struct sockaddr_un serv_addr; unsigned int retrycount = 0; @@ -403,8 +403,7 @@ int mc_ipc_service_connect(const int type) } /*Create Socket*/ - ret = mc_ipc_create_client_socket(MC_TIMEOUT_SEC_5, &sock_info); - sockfd = sock_info.sock_fd; + ret = mc_ipc_create_client_socket(MC_TIMEOUT_SEC_5, &sockfd); mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "socket is not created properly"); /*Set server Address*/ @@ -415,14 +414,15 @@ int mc_ipc_service_connect(const int type) /* Connecting to the media controller service */ if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { mc_stderror("connect error"); - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); + if (errno == EACCES) return MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED; else return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } - mc_ipc_delete_client_socket(&sock_info); + close(sockfd); ret = __is_service_activated(type); if (ret == MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED) { diff --git a/svc/include/media_controller_socket.h b/svc/include/media_controller_socket.h index 1bf5422..48798c8 100755 --- a/svc/include/media_controller_socket.h +++ b/svc/include/media_controller_socket.h @@ -50,11 +50,6 @@ typedef enum { } mc_msg_type_e; typedef struct { - int sock_fd; - char *sock_path; -} mc_sock_info_s; - -typedef struct { mc_msg_type_e msg_type; int type; int pid; @@ -64,8 +59,7 @@ typedef struct { char msg[MAX_MSG_SIZE]; } mc_comm_msg_s; -int mc_ipc_create_client_socket(int timeout_sec, mc_sock_info_s* sock_info); -int mc_ipc_delete_client_socket(mc_sock_info_s* sock_info); +int mc_ipc_create_client_socket(int timeout_sec, int *sock_fd); int mc_ipc_create_server_socket(mc_msg_port_type_e port, int *sock_fd); int mc_ipc_send_msg_to_client_tcp(int sockfd, mc_comm_msg_s *send_msg, struct sockaddr_un *client_addr); int mc_ipc_receive_message_tcp(int client_sock, mc_comm_msg_s *recv_msg); diff --git a/svc/media_controller_socket.c b/svc/media_controller_socket.c index 6e76b54..155f493 100755 --- a/svc/media_controller_socket.c +++ b/svc/media_controller_socket.c @@ -23,7 +23,7 @@ #include "media_controller_db_util.h" #include "media_controller_socket.h" -int mc_ipc_create_client_socket(int timeout_sec, mc_sock_info_s *sock_info) +int mc_ipc_create_client_socket(int timeout_sec, int *sock_fd) { int sock = -1; @@ -43,32 +43,11 @@ int mc_ipc_create_client_socket(int timeout_sec, mc_sock_info_s *sock_info) } } - sock_info->sock_fd = sock; - sock_info->sock_path = NULL; + *sock_fd = sock; return MEDIA_CONTROLLER_ERROR_NONE; } -int mc_ipc_delete_client_socket(mc_sock_info_s *sock_info) -{ - int ret = 0; - - mc_debug("sockfd %d close", sock_info->sock_fd); - if (close(sock_info->sock_fd) < 0) - mc_stderror("sockfd close failed"); - - if (sock_info->sock_path != NULL) { -#if 0 - ret = unlink(sock_info->sock_path); - if (ret < 0) - mc_stderror("unlink failed"); -#endif - free(sock_info->sock_path); - } - - return ret; -} - int mc_ipc_create_server_socket(mc_msg_port_type_e port, int *sock_fd) { int i = 0; |