dns / use cancellable instead of blocking

This commit is contained in:
Benjamin Sergeant 2019-06-30 23:26:14 -07:00
parent 5b73edec8c
commit 747746cba1
3 changed files with 13 additions and 13 deletions

View File

@ -50,14 +50,14 @@ namespace ix
struct addrinfo* DNSLookup::resolve(std::string& errMsg, struct addrinfo* DNSLookup::resolve(std::string& errMsg,
const CancellationRequest& isCancellationRequested, const CancellationRequest& isCancellationRequested,
bool blocking) bool cancellable)
{ {
return blocking ? resolveBlocking(errMsg, isCancellationRequested) return cancellable ? resolveCancellable(errMsg, isCancellationRequested)
: resolveAsync(errMsg, isCancellationRequested); : resolveUnCancellable(errMsg, isCancellationRequested);
} }
struct addrinfo* DNSLookup::resolveBlocking(std::string& errMsg, struct addrinfo* DNSLookup::resolveUnCancellable(std::string& errMsg,
const CancellationRequest& isCancellationRequested) const CancellationRequest& isCancellationRequested)
{ {
errMsg = "no error"; errMsg = "no error";
@ -71,8 +71,8 @@ namespace ix
return getAddrInfo(_hostname, _port, errMsg); return getAddrInfo(_hostname, _port, errMsg);
} }
struct addrinfo* DNSLookup::resolveAsync(std::string& errMsg, struct addrinfo* DNSLookup::resolveCancellable(std::string& errMsg,
const CancellationRequest& isCancellationRequested) const CancellationRequest& isCancellationRequested)
{ {
errMsg = "no error"; errMsg = "no error";

View File

@ -29,13 +29,13 @@ namespace ix
struct addrinfo* resolve(std::string& errMsg, struct addrinfo* resolve(std::string& errMsg,
const CancellationRequest& isCancellationRequested, const CancellationRequest& isCancellationRequested,
bool blocking = false); bool cancellable = true);
private: private:
struct addrinfo* resolveAsync(std::string& errMsg, struct addrinfo* resolveCancellable(std::string& errMsg,
const CancellationRequest& isCancellationRequested); const CancellationRequest& isCancellationRequested);
struct addrinfo* resolveBlocking(std::string& errMsg, struct addrinfo* resolveUnCancellable(std::string& errMsg,
const CancellationRequest& isCancellationRequested); const CancellationRequest& isCancellationRequested);
static struct addrinfo* getAddrInfo(const std::string& hostname, static struct addrinfo* getAddrInfo(const std::string& hostname,
int port, int port,

View File

@ -12,7 +12,7 @@ brew:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install) mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install)
ws: 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: uninstall:
xargs rm -fv < build/install_manifest.txt xargs rm -fv < build/install_manifest.txt