summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/daemon/dlt-daemon.c13
-rwxr-xr-xsrc/daemon/dlt-daemon.h1
-rw-r--r--src/daemon/dlt.conf3
3 files changed, 17 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 47c395f..335e3e4 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -221,6 +221,7 @@ int option_file_parser(DltDaemonLocal *daemon_local)
daemon_local->flags.loggingMode = 0;
daemon_local->flags.loggingLevel = 6;
strncpy(daemon_local->flags.loggingFilename, DLT_USER_DIR "/dlt.log",sizeof(daemon_local->flags.loggingFilename));
+ daemon_local->timeoutOnSend = 4;
daemon_local->flags.sendECUSoftwareVersion = 0;
memset(daemon_local->flags.pathToECUSoftwareVersion, 0, sizeof(daemon_local->flags.pathToECUSoftwareVersion));
@@ -344,6 +345,11 @@ int option_file_parser(DltDaemonLocal *daemon_local)
strncpy(daemon_local->flags.loggingFilename,value,sizeof(daemon_local->flags.loggingFilename) - 1);
//printf("Option: %s=%s\n",token,value);
}
+ else if(strcmp(token,"TimeOutOnSend")==0)
+ {
+ daemon_local->timeoutOnSend = atoi(value);
+ //printf("Option: %s=%s\n",token,value);
+ }
else if(strcmp(token,"SharedMemorySize")==0)
{
daemon_local->flags.sharedMemorySize = atoi(value);
@@ -1199,6 +1205,13 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, DltDaemonLocal *daemon_
dlt_daemon_applications_invalidate_fd(daemon,in_sock,verbose);
dlt_daemon_contexts_invalidate_fd(daemon,in_sock,verbose);
+ /* Set socket timeout in reception */
+ struct timeval timeout_send;
+ timeout_send.tv_sec = daemon_local->timeoutOnSend;
+ timeout_send.tv_usec = 0;
+ if (setsockopt (in_sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout_send, sizeof(timeout_send)) < 0)
+ dlt_log(LOG_ERR, "setsockopt failed\n");
+
//sprintf("str,"Client Connection from %s\n", inet_ntoa(cli.sin_addr));
//dlt_log(str);
FD_SET(in_sock, &(daemon_local->master)); /* add to master set */
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index f2b1dd9..91bb58d 100755
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -134,6 +134,7 @@ typedef struct
#if defined(DLT_SYSTEMD_WATCHDOG_ENABLE)
uint32_t lastOperationTime;
#endif
+ int timeoutOnSend;
} DltDaemonLocal;
typedef struct
diff --git a/src/daemon/dlt.conf b/src/daemon/dlt.conf
index 909d4f4..e09129a 100644
--- a/src/daemon/dlt.conf
+++ b/src/daemon/dlt.conf
@@ -41,6 +41,9 @@ LoggingLevel = 6
# The logging filename if internal logging mode is log to file (Default: /tmp/dlt.log)
LoggingFilename = /tmp/dlt.log
+# Timeout on send to client (sec)
+TimeOutOnSend = 4
+
########################################################################
# Offline Trace memory #
########################################################################