Skip to content

Commit fd9b063

Browse files
committed
Retry according to number of desired retries,
no matter the error type. Signed-off-by: Antonio Mignolli <antoniomignolli@gmail.com>
1 parent 729242a commit fd9b063

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/config.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -242,21 +242,11 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value)
242242
ret = getaddrinfo(begin, end, &hints, &resolved);
243243
if (!ret)
244244
break;
245-
/* The set of return codes that are "permanent failures". All other possibilities are potentially transient.
246-
*
247-
* This is according to https://sourceware.org/glibc/wiki/NameResolver which states:
248-
* "From the perspective of the application that calls getaddrinfo() it perhaps
249-
* doesn't matter that much since EAI_FAIL, EAI_NONAME and EAI_NODATA are all
250-
* permanent failure codes and the causes are all permanent failures in the
251-
* sense that there is no point in retrying later."
252-
*
253-
* So this is what we do, except FreeBSD removed EAI_NODATA some time ago, so that's conditional.
254-
*/
255-
if (ret == EAI_NONAME || ret == EAI_FAIL ||
256-
#ifdef EAI_NODATA
257-
ret == EAI_NODATA ||
258-
#endif
259-
(retries >= 0 && !retries--)) {
245+
/*
246+
Treating all errors as possibly temporary.
247+
Armbian has been reported to not distinguish between a temporary and a permanent DNS resolution error
248+
*/
249+
if (retries >= 0 && !retries--) {
260250
free(mutable);
261251
fprintf(stderr, "%s: `%s'\n", ret == EAI_SYSTEM ? strerror(errno) : gai_strerror(ret), value);
262252
return false;

0 commit comments

Comments
 (0)