projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Clarification in DNS test.
[awesomized/libmemcached]
/
libtest
/
dns.cc
diff --git
a/libtest/dns.cc
b/libtest/dns.cc
index 3623c4a1f58caa48babff535916e88c141b385ea..e8e1e7fc8cc3993f2955ba3433f133d5749a6d9d 100644
(file)
--- a/
libtest/dns.cc
+++ b/
libtest/dns.cc
@@
-45,16
+45,29
@@
namespace libtest {
bool lookup(const char* host)
{
bool lookup(const char* host)
{
- assert(host);
bool success= false;
bool success= false;
- struct addrinfo *addrinfo= NULL;
-
- int limit= 5;
- while (limit--)
+ if (host)
{
{
- int ret;
- if ((ret= getaddrinfo(host, NULL, NULL, &(addrinfo))))
+ assert(host);
+ struct addrinfo *addrinfo= NULL;
+
+ int limit= 5;
+ while (--limit and success == false)
{
{
+ if (addrinfo)
+ {
+ freeaddrinfo(addrinfo);
+ addrinfo= NULL;
+ }
+
+ int ret;
+ fprintf(stderr, ":%s:\n", host);
+ if ((ret= getaddrinfo(host, NULL, NULL, &addrinfo)) == 0)
+ {
+ success= true;
+ break;
+ }
+
switch (ret)
{
case EAI_AGAIN:
switch (ret)
{
case EAI_AGAIN:
@@
-64,16
+77,16
@@
bool lookup(const char* host)
default:
break;
}
default:
break;
}
+
+ break;
}
}
- else
+
+ if (addrinfo)
{
{
- success= true;
- break;
+ freeaddrinfo(addrinfo);
}
}
}
}
- freeaddrinfo(addrinfo);
-
return success;
}
return success;
}
@@
-87,7
+100,7
@@
bool check_dns()
if (lookup("does_not_exist.gearman.info")) // This should fail, if it passes,...
{
if (lookup("does_not_exist.gearman.info")) // This should fail, if it passes,...
{
-
return false
;
+
fatal_assert("Your service provider sucks and is providing bogus DNS. You might be in an airport.")
;
}
return true;
}
return true;