summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Mohr <alexander.m.mohr@mercedes-benz.com>2022-08-10 11:15:49 +0200
committerGitHub <noreply@github.com>2022-08-10 16:15:49 +0700
commit0595b466085313982e8bc796d4a061cf7d0e9bf2 (patch)
tree8b6fc68c86a09b13197654fc7bf691a234022098
parentfcc59cece4dc19311ed15d2ac70af7dfead7cca6 (diff)
downloadDLT-daemon-0595b466085313982e8bc796d4a061cf7d0e9bf2.tar.gz
dlt-daemon-connection: Start up even if not all bindings are valid (#380)
dlt-daemon allows configuration of multiple addresses. Before this commit the daemon exits when the first binding fails. This commit changes the behavior so that the daemon only exits if none of the configured addresses can be opened. Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
-rw-r--r--src/daemon/dlt-daemon.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index b7aac0d..8e3e646 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1621,6 +1621,7 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon,
}
}
else {
+ bool any_open = false;
while (head != NULL) { /* open socket for each IP in the bindAddress list */
if (dlt_daemon_socket_open(&fd, daemon_local->flags.port, head->ip) == DLT_RETURN_OK) {
@@ -1629,17 +1630,22 @@ int dlt_daemon_local_connection_init(DltDaemon *daemon,
fd,
POLLIN,
DLT_CONNECTION_CLIENT_CONNECT)) {
- dlt_log(LOG_ERR, "Could not initialize main socket.\n");
- return DLT_RETURN_ERROR;
+ dlt_vlog(LOG_ERR, "Could not create connection, for binding %s\n", head->ip);
+ } else {
+ any_open = true;
}
}
else {
- dlt_log(LOG_ERR, "Could not initialize main socket.\n");
- return DLT_RETURN_ERROR;
+ dlt_vlog(LOG_ERR, "Could not open main socket, for binding %s\n", head->ip);
}
head = head->next;
}
+
+ if (!any_open) {
+ dlt_vlog(LOG_ERR, "Failed create main socket for any configured binding\n");
+ return DLT_RETURN_ERROR;
+ }
}
#ifdef UDP_CONNECTION_SUPPORT