From 8af687aa666893cbfcfa0ced1929aae6c0de2948 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 6 Jan 2023 11:49:27 +0100 Subject: [PATCH] retry config check once --- src/ebusd/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ebusd/main.cpp b/src/ebusd/main.cpp index dc50dc28..c7ecb980 100644 --- a/src/ebusd/main.cpp +++ b/src/ebusd/main.cpp @@ -1420,8 +1420,12 @@ int main(int argc, char* argv[], char* envp[]) { logError(lf_main, "invalid configPath URL"); return EINVAL; } - if (!lazyHttpClient() - || !s_configHttpClient->connect(configHost, configPort, proto == "https", PACKAGE_NAME "/" PACKAGE_VERSION)) { + if (!lazyHttpClient() || ( + // check with low timeout of 1 second initially: + !s_configHttpClient->connect(configHost, configPort, proto == "https", PACKAGE_NAME "/" PACKAGE_VERSION, 1) + // if that did not work, issue a single retry with default timeout: + && !s_configHttpClient->connect(configHost, configPort, proto == "https", PACKAGE_NAME "/" PACKAGE_VERSION) + )) { logError(lf_main, "invalid configPath URL (connect)"); cleanup(); return EINVAL;