mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-20 05:28:01 +00:00
BackgroundResolver test.
This commit is contained in:
parent
2ad69237cf
commit
61021fc778
@ -79,7 +79,7 @@ public:
|
||||
* @param callback Callback function to receive notification or NULL if none
|
||||
* @praam arg Second argument to callback function
|
||||
*/
|
||||
void resolveNow(void (*callback)(BackgroundResolver *,void *),void *arg);
|
||||
void resolveNow(void (*callback)(BackgroundResolver *,void *) = 0,void *arg = 0);
|
||||
|
||||
/**
|
||||
* Abort (abandon) any current resolve jobs
|
||||
|
19
selftest.cpp
19
selftest.cpp
@ -55,6 +55,7 @@
|
||||
#include "osdep/OSUtils.hpp"
|
||||
#include "osdep/Phy.hpp"
|
||||
#include "osdep/Http.hpp"
|
||||
#include "osdep/BackgroundResolver.hpp"
|
||||
|
||||
#ifdef ZT_ENABLE_NETWORK_CONTROLLER
|
||||
#include "controller/SqliteNetworkController.hpp"
|
||||
@ -769,6 +770,23 @@ static int testSqliteNetworkController()
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int testResolver()
|
||||
{
|
||||
std::cout << "[resolver] Testing BackgroundResolver..."; std::cout.flush();
|
||||
|
||||
BackgroundResolver r("tcp-fallback.zerotier.com");
|
||||
r.resolveNow();
|
||||
r.wait();
|
||||
|
||||
std::vector<InetAddress> ips(r.get());
|
||||
for(std::vector<InetAddress>::const_iterator ip(ips.begin());ip!=ips.end();++ip) {
|
||||
std::cout << ' ' << ip->toString();
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int testHttp()
|
||||
{
|
||||
std::map<std::string,std::string> requestHeaders,responseHeaders;
|
||||
@ -873,6 +891,7 @@ int main(int argc,char **argv)
|
||||
r |= testIdentity();
|
||||
r |= testCertificate();
|
||||
r |= testPhy();
|
||||
r |= testResolver();
|
||||
r |= testHttp();
|
||||
|
||||
if (r)
|
||||
|
Loading…
Reference in New Issue
Block a user