Anticipate nxdomains even after resolving (#18)

Turns out resolving server endpoint and sending request to this endoint
are racy with respect to domain name resolution: for some reason
`gen_tcp` resolves literal IP addresses through general DNS
mechanism. This means that in the event DNS goes down between resolving
step and sending step one could get `{error, nxdomain}` in the second
step.
This commit is contained in:
Andrew Mayorov 2022-09-06 11:09:26 +03:00 committed by GitHub
parent 3ddacb9296
commit 90d386c252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -244,6 +244,7 @@ handle_result({error, Reason}, WoodyState) when
Reason =:= enetunreach;
Reason =:= ehostunreach;
Reason =:= eacces;
Reason =:= nxdomain;
element(1, Reason) =:= resolve_failed
->
BinReason = woody_error:format_details(Reason),

View File

@ -275,6 +275,7 @@ handle_response({error, Reason}, WoodyState) when
Reason =:= enetunreach;
Reason =:= ehostunreach;
Reason =:= eacces;
Reason =:= nxdomain;
element(1, Reason) =:= resolve_failed
->
BinReason = woody_error:format_details(Reason),