From 747746cba1d7c96d0f5625edd18461489fa2c817 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Sun, 30 Jun 2019 23:26:14 -0700 Subject: [PATCH] dns / use cancellable instead of blocking --- ixwebsocket/IXDNSLookup.cpp | 14 +++++++------- ixwebsocket/IXDNSLookup.h | 10 +++++----- makefile | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ixwebsocket/IXDNSLookup.cpp b/ixwebsocket/IXDNSLookup.cpp index 75898f55..1d71993f 100644 --- a/ixwebsocket/IXDNSLookup.cpp +++ b/ixwebsocket/IXDNSLookup.cpp @@ -50,14 +50,14 @@ namespace ix struct addrinfo* DNSLookup::resolve(std::string& errMsg, const CancellationRequest& isCancellationRequested, - bool blocking) + bool cancellable) { - return blocking ? resolveBlocking(errMsg, isCancellationRequested) - : resolveAsync(errMsg, isCancellationRequested); + return cancellable ? resolveCancellable(errMsg, isCancellationRequested) + : resolveUnCancellable(errMsg, isCancellationRequested); } - struct addrinfo* DNSLookup::resolveBlocking(std::string& errMsg, - const CancellationRequest& isCancellationRequested) + struct addrinfo* DNSLookup::resolveUnCancellable(std::string& errMsg, + const CancellationRequest& isCancellationRequested) { errMsg = "no error"; @@ -71,8 +71,8 @@ namespace ix return getAddrInfo(_hostname, _port, errMsg); } - struct addrinfo* DNSLookup::resolveAsync(std::string& errMsg, - const CancellationRequest& isCancellationRequested) + struct addrinfo* DNSLookup::resolveCancellable(std::string& errMsg, + const CancellationRequest& isCancellationRequested) { errMsg = "no error"; diff --git a/ixwebsocket/IXDNSLookup.h b/ixwebsocket/IXDNSLookup.h index e56c2816..30b364ba 100644 --- a/ixwebsocket/IXDNSLookup.h +++ b/ixwebsocket/IXDNSLookup.h @@ -29,13 +29,13 @@ namespace ix struct addrinfo* resolve(std::string& errMsg, const CancellationRequest& isCancellationRequested, - bool blocking = false); + bool cancellable = true); private: - struct addrinfo* resolveAsync(std::string& errMsg, - const CancellationRequest& isCancellationRequested); - struct addrinfo* resolveBlocking(std::string& errMsg, - const CancellationRequest& isCancellationRequested); + struct addrinfo* resolveCancellable(std::string& errMsg, + const CancellationRequest& isCancellationRequested); + struct addrinfo* resolveUnCancellable(std::string& errMsg, + const CancellationRequest& isCancellationRequested); static struct addrinfo* getAddrInfo(const std::string& hostname, int port, diff --git a/makefile b/makefile index ea55fe54..ce8730f7 100644 --- a/makefile +++ b/makefile @@ -12,7 +12,7 @@ brew: mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install) ws: - mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 -DUSE_VENDORED_THIRD_PARTY=1 .. ; make -j) + mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; make -j) uninstall: xargs rm -fv < build/install_manifest.txt