diff options
author | Brian Aker <brian@tangent.org> | 2013-05-03 03:36:06 -0400 |
---|---|---|
committer | Brian Aker <brian@tangent.org> | 2013-05-03 03:36:06 -0400 |
commit | a07e53df4cd8d1e215a49eeac5d5d06fa0a50fb4 (patch) | |
tree | 3ff418f955d4e8f6ae88f84a6a3b3d14eae1bb7f /libtest/dns.cc | |
parent | 2973993864cf1347163ddfacbbab4f334ff33d35 (diff) | |
download | libmemcached-a07e53df4cd8d1e215a49eeac5d5d06fa0a50fb4.tar.gz |
Update libtest.
Diffstat (limited to 'libtest/dns.cc')
-rw-r--r-- | libtest/dns.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libtest/dns.cc b/libtest/dns.cc index 0becfc99..75a5bbfb 100644 --- a/libtest/dns.cc +++ b/libtest/dns.cc @@ -46,10 +46,14 @@ namespace libtest { bool lookup(const char* host) { bool success= false; - if (host) + assert(host and host[0]); + if (host and host[0]) { - assert(host); struct addrinfo *addrinfo= NULL; + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype= SOCK_STREAM; + hints.ai_protocol= IPPROTO_TCP; int limit= 5; while (--limit and success == false) @@ -61,7 +65,7 @@ bool lookup(const char* host) } int ret; - if ((ret= getaddrinfo(host, NULL, NULL, &addrinfo)) == 0) + if ((ret= getaddrinfo(host, "echo", &hints, &addrinfo)) == 0) { success= true; break; @@ -92,6 +96,11 @@ bool lookup(const char* host) bool check_dns() { + if (valgrind_is_caller()) + { + return false; + } + if (lookup("exist.gearman.info") == false) { return false; |