From 5a382100320ef339b738a5b3db900e9f2577d9b5 Mon Sep 17 00:00:00 2001 From: Jiyong Date: Tue, 12 Mar 2024 09:12:09 +0900 Subject: [PATCH] Remove unused codes Change-Id: I3ec6840dafb808932244c58ca33c1b1603e50f67 --- packaging/capi-media-controller.spec | 2 +- svc/include/media_controller_socket.h | 12 +----------- svc/media_controller_socket.c | 36 +---------------------------------- svc/media_controller_svc.c | 4 ++-- 4 files changed, 5 insertions(+), 49 deletions(-) diff --git a/packaging/capi-media-controller.spec b/packaging/capi-media-controller.spec index 40a1654..72455ef 100644 --- 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.2.44 +Version: 0.2.45 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/svc/include/media_controller_socket.h b/svc/include/media_controller_socket.h index da5b009..d9f4f00 100755 --- a/svc/include/media_controller_socket.h +++ b/svc/include/media_controller_socket.h @@ -26,18 +26,10 @@ extern "C" { #endif /* __cplusplus */ -#define SERVER_IP "127.0.0.1" #define MC_TIMEOUT_SEC_5 5 /* Response from daemon time out */ #define MAX_MSG_SIZE 10 * 1024 /* Maximum of message to daemon */ -#define MC_SOCK_NOT_ALLOCATE -1 #define MC_SOCK_ACTIVATION_PATH "/run/.mediacontroller.sock" /* tzplatform_mkpath(TZ_SYS_RUN, ".media_controller.sock") */ #define MC_IPC_PATH "/run/.mediacontroller-comm.sock" /* tzplatform_mkpath(TZ_SYS_RUN, ".media_controller-comm.sock") */ -#define MC_SERVER_DISCONNECTION_MSG "Disonnect" - -typedef enum { - MC_DB_UPDATE_PORT, /**< Media Controller DB Update */ - MC_PORT_MAX, -} mc_msg_port_type_e; typedef enum { MC_MSG_DB_UPDATE, /**< Media Controller DB Update */ @@ -65,9 +57,7 @@ typedef struct { } mc_comm_msg_s; 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); +int mc_ipc_create_server_socket(int *sock_fd); int mc_ipc_accept_client_tcp(int serv_sock, int* client_sock); #ifdef __cplusplus diff --git a/svc/media_controller_socket.c b/svc/media_controller_socket.c index 63bd663..885e101 100644 --- a/svc/media_controller_socket.c +++ b/svc/media_controller_socket.c @@ -48,7 +48,7 @@ int mc_ipc_create_client_socket(int timeout_sec, int *sock_fd) return MEDIA_CONTROLLER_ERROR_NONE; } -int mc_ipc_create_server_socket(mc_msg_port_type_e port, int *sock_fd) +int mc_ipc_create_server_socket(int *sock_fd) { int i = 0; bool bind_success = false; @@ -104,40 +104,6 @@ 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 ret = MEDIA_CONTROLLER_ERROR_NONE; - - if (write(sockfd, send_msg, sizeof(*(send_msg))) != sizeof(*(send_msg))) { - mc_stderror("sendto failed"); - ret = MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; - } else { - mc_debug("sent result [%d]", send_msg->result); - mc_debug("result message [%s]", send_msg->msg); - } - - return ret; -} - -int mc_ipc_receive_message_tcp(int client_sock, mc_comm_msg_s *recv_msg) -{ - int recv_msg_size = 0; - - if ((recv_msg_size = read(client_sock, recv_msg, sizeof(mc_comm_msg_s))) < 0) { - if (errno == EWOULDBLOCK) { - mc_error("Timeout. Can't try any more"); - return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; - } else { - mc_stderror("recv failed"); - return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; - } - } - - mc_secure_debug("receive msg from [%d(%d)] %d, %s", recv_msg->pid, recv_msg->uid, recv_msg->msg_type, recv_msg->msg); - - return MEDIA_CONTROLLER_ERROR_NONE; -} - int mc_ipc_accept_client_tcp(int serv_sock, int *client_sock) { int sockfd = -1; diff --git a/svc/media_controller_svc.c b/svc/media_controller_svc.c index c48831d..bdce471 100644 --- a/svc/media_controller_svc.c +++ b/svc/media_controller_svc.c @@ -614,7 +614,7 @@ static gboolean __mc_read_service_request_tcp_socket(GIOChannel *src, GIOConditi req->client_sock = client_sock; msg = mc_cynara_receive_untrusted_message(req->client_sock, req->req_msg, &creds); if (msg != MEDIA_CONTROLLER_ERROR_NONE) { - mc_error("mc_ipc_receive_message_tcp failed [%d]", msg); + mc_error("mc_cynara_receive_untrusted_message failed [%d]", msg); goto ERROR; } @@ -737,7 +737,7 @@ gpointer mc_svc_thread(gpointer data) } /* Create TCP Socket*/ - ret = mc_ipc_create_server_socket(MC_DB_UPDATE_PORT, &sockfd); + ret = mc_ipc_create_server_socket(&sockfd); if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("Failed to create socket"); return NULL; -- 2.7.4