summaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
authorsunil.s <sunil.s@lge.com>2019-10-14 12:05:16 +0530
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2019-10-14 13:55:02 +0200
commitb55972cd33df6e02ffcefcb577fbb83fb72b2ef8 (patch)
tree3278d631bd6d2dbc050c70116a48b6b97795951a /src/daemon
parent5e381162a944ffd0b7780175adf9670a1acbd491 (diff)
downloadDLT-daemon-b55972cd33df6e02ffcefcb577fbb83fb72b2ef8.tar.gz
Removed unused headers(epoll) in UDP connection
Signed-off-by: sunil.s <sunil.s@lge.com>
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/dlt-daemon.c8
-rw-r--r--src/daemon/udp_connection/dlt_daemon_udp_common_socket.h5
-rw-r--r--src/daemon/udp_connection/dlt_daemon_udp_socket.c16
-rw-r--r--src/daemon/udp_connection/dlt_daemon_udp_socket.h2
4 files changed, 21 insertions, 10 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 0fab07a..9b3444b 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -912,6 +912,10 @@ int main(int argc, char *argv[])
dlt_daemon_local_cleanup(&daemon, &daemon_local, daemon_local.flags.vflag);
+#ifdef UDP_CONNECTION_SUPPORT
+ dlt_daemon_udp_close_connection();
+#endif
+
dlt_gateway_deinit(&daemon_local.pGateway, daemon_local.flags.vflag);
dlt_daemon_free(&daemon, daemon_local.flags.vflag);
@@ -1317,11 +1321,11 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon,
if (daemon_local->UDPConnectionSetup == MULTICAST_CONNECTION_ENABLED) {
if (dlt_daemon_udp_connection_setup(daemon_local) < 0) {
- dlt_log(LOG_ERR, "UDP fd creation and register in epoll failed\n");
+ dlt_log(LOG_ERR, "UDP fd creation failed\n");
return DLT_RETURN_ERROR;
}
else {
- dlt_log(LOG_INFO, "UDP fd creation and register in epoll success\n");
+ dlt_log(LOG_INFO, "UDP fd creation success\n");
}
}
diff --git a/src/daemon/udp_connection/dlt_daemon_udp_common_socket.h b/src/daemon/udp_connection/dlt_daemon_udp_common_socket.h
index 8ecd0d6..d780851 100644
--- a/src/daemon/udp_connection/dlt_daemon_udp_common_socket.h
+++ b/src/daemon/udp_connection/dlt_daemon_udp_common_socket.h
@@ -33,15 +33,10 @@
#include <string.h> /* for memset() */
#include <syslog.h>
#include <sys/socket.h> /* for socket(), connect(), (), and recv() */
-#include <sys/ioctl.h>
-#include <sys/epoll.h>
#include <unistd.h> /* for close() */
#include "dlt_common.h"
#include "dlt-daemon.h"
-#include "dlt_daemon_common_cfg.h"
-#include "dlt_daemon_client.h"
-#include "dlt_daemon_connection.h"
#include "dlt_daemon_udp_socket.h"
#include "dlt_types.h"
diff --git a/src/daemon/udp_connection/dlt_daemon_udp_socket.c b/src/daemon/udp_connection/dlt_daemon_udp_socket.c
index a2a66d9..2ef629a 100644
--- a/src/daemon/udp_connection/dlt_daemon_udp_socket.c
+++ b/src/daemon/udp_connection/dlt_daemon_udp_socket.c
@@ -46,10 +46,8 @@ void dlt_daemon_udp_init_clientstruct(DltDaemonClientSockInfo *clientinfo_struct
clientinfo_struct->clientaddr_size = sizeof(clientinfo_struct->clientaddr);
clientinfo_struct->isvalidflag = ADDRESS_INVALID; /* info is invalid */
dlt_vlog(LOG_DEBUG, "%s: client addr struct init success \n", __func__);
- dlt_log(LOG_INFO, "dlt_daemon_udp_init_clientstruct: client addr struct init success \n");
}
-
/* ************************************************************************** */
/* Function : dlt_daemon_udp_setmulticast_addr */
/* In Param : NIL */
@@ -79,7 +77,6 @@ void dlt_daemon_udp_setmulticast_addr(DltDaemonLocal *daemon_local)
/* In Param : contains daemon param values used globally */
/* Out Param : status of udp connection setup and fd registration */
/* Description: DataGram socket fd connection is setup */
-/* fd is registered with the epoll */
/* ************************************************************************** */
DltReturnValue dlt_daemon_udp_connection_setup(DltDaemonLocal *daemon_local)
{
@@ -256,3 +253,16 @@ void dlt_daemon_udp_clientmsg_send(DltDaemonClientSockInfo *clientinfo,
dlt_vlog(LOG_ERR, "%s: size2 <= 0\n", __func__);
}
}
+
+/* ************************************************************************** */
+/* Function : dlt_daemon_udp_close_connection */
+/* In Param : NIL */
+/* Out Param : NIL */
+/* Description: Closes UDP Connection */
+/* ************************************************************************** */
+void dlt_daemon_udp_close_connection(void)
+{
+ if (close(g_udp_sock_fd) == SYSTEM_CALL_ERROR)
+ dlt_vlog(LOG_WARNING, "[%s:%d] close error %s\n", __func__, __LINE__,
+ strerror(errno));
+}
diff --git a/src/daemon/udp_connection/dlt_daemon_udp_socket.h b/src/daemon/udp_connection/dlt_daemon_udp_socket.h
index 3607bd7..caeaacd 100644
--- a/src/daemon/udp_connection/dlt_daemon_udp_socket.h
+++ b/src/daemon/udp_connection/dlt_daemon_udp_socket.h
@@ -29,4 +29,6 @@
DltReturnValue dlt_daemon_udp_connection_setup(DltDaemonLocal *daemon_local);
void dlt_daemon_udp_dltmsg_multicast(void *data1, int size1, void *data2, int size2,
int verbose);
+void dlt_daemon_udp_close_connection(void);
+
#endif /* DLT_DAEMON_UDP_SOCKET_H */