projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Update bootstrap
[awesomized/libmemcached]
/
libtest
/
dns.cc
diff --git
a/libtest/dns.cc
b/libtest/dns.cc
index a293caa3b4319a83cf43a8adb734f7835dc2bb12..0becfc99107f22068e22d512ab9cc2e971989754 100644
(file)
--- a/
libtest/dns.cc
+++ b/
libtest/dns.cc
@@
-34,7
+34,7
@@
*
*/
*
*/
-#include "
mem_config
.h"
+#include "
libtest/yatlcon
.h"
#include <libtest/common.h>
#include <sys/types.h>
#include <libtest/common.h>
#include <sys/types.h>
@@
-45,16
+45,28
@@
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;
+ if ((ret= getaddrinfo(host, NULL, NULL, &addrinfo)) == 0)
+ {
+ success= true;
+ break;
+ }
+
switch (ret)
{
case EAI_AGAIN:
switch (ret)
{
case EAI_AGAIN:
@@
-64,16
+76,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
+99,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;