[core] add support for stale responses

We're now returning stale responses from cache. Those responses will have the `stale` flag set to true. Currently, all requesters in the core code discard stale responses, and cancel the request immediately after they got a non-stale response.
This commit is contained in:
Konstantin Käfer
2015-10-15 21:30:21 +02:00
parent 096a3edf39
commit 6a7334b882
23 changed files with 365 additions and 45 deletions

View File

@@ -106,6 +106,10 @@ void MapContext::setStyleURL(const std::string& url) {
FileSource* fs = util::ThreadContext::getFileSource();
styleRequest = fs->request({ Resource::Kind::Style, styleURL }, util::RunLoop::getLoop(), [this, base](const Response &res) {
if (res.stale) {
// Only handle fresh responses.
return;
}
styleRequest = nullptr;
if (res.status == Response::Successful) {