Move setReachability to CachingHTTPFileSource

This commit is contained in:
John Firebaugh
2014-12-04 15:10:27 -08:00
parent 9aff2c386c
commit 16fe8e64c4
7 changed files with 15 additions and 26 deletions

View File

@@ -100,16 +100,17 @@ void CachingHTTPFileSource::prepare(std::function<void()> fn) {
}
}
void CachingHTTPFileSource::retryAllPending() {
assert(thread_id == std::this_thread::get_id());
util::ptr<BaseRequest> req;
for (const std::pair<std::string, std::weak_ptr<BaseRequest>> &pair : pending) {
if ((req = pair.second.lock())) {
req->retryImmediately();
}
void CachingHTTPFileSource::setReachability(bool reachable) {
if (reachable && loop) {
prepare([this]() {
util::ptr<BaseRequest> req;
for (const std::pair<std::string, std::weak_ptr<BaseRequest>> &pair : pending) {
if ((req = pair.second.lock())) {
req->retryImmediately();
}
}
});
}
}
}