cancellation refactoring

This commit is contained in:
Benjamin Sergeant committed 2019-01-03 12:53:44 -08:00
1 parent df6a17dcc2
commit ed3a50d9b5
7 files changed
+52 -70

No files matched your search

+1 -12
View File
@@ -14,9 +14,7 @@
namespace ix
{
// 60s timeout, see IXSocketConnect.cpp
const int64_t DNSLookup::kDefaultTimeout = 60 * 1000; // ms
const int64_t DNSLookup::kDefaultWait = 10; // ms
const int64_t DNSLookup::kDefaultWait = 10; // ms
std::atomic<uint64_t> DNSLookup::_nextId(0);
std::set<uint64_t> DNSLookup::_activeJobs;
@@ -112,7 +110,6 @@ namespace ix
_thread = std::thread(&DNSLookup::run, this);
_thread.detach();
int64_t timeout = kDefaultTimeout;
std::unique_lock<std::mutex> lock(_conditionVariableMutex);
while (!_done)
@@ -131,14 +128,6 @@ namespace ix
errMsg = "cancellation requested";
return nullptr;
}
// Have we exceeded the timeout ?
timeout -= _wait;
if (timeout <= 0)
{
errMsg = "dns lookup timed out after 60 seconds";
return nullptr;
}
}
// Maybe a cancellation request got in before the bg terminated ?