diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-14 20:42:03 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-14 20:42:03 +0000 |
commit | 1c42c0569faa469bd6fb5f76069920af6fc1ddd5 (patch) | |
tree | 25e0d50f895a308bdc074f821cccc745190ff2e1 /content/llcache.c | |
parent | 0235cc68d81ff6fde3d736b587de00c0f16c6c0b (diff) | |
download | netsurf-1c42c0569faa469bd6fb5f76069920af6fc1ddd5.tar.gz netsurf-1c42c0569faa469bd6fb5f76069920af6fc1ddd5.tar.bz2 |
Ensure we invalidate cache data and mark objects as complete on failure to fetch.
svn path=/trunk/netsurf/; revision=10402
Diffstat (limited to 'content/llcache.c')
-rw-r--r-- | content/llcache.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/content/llcache.c b/content/llcache.c index 4394d186d..930ed5543 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -1516,6 +1516,11 @@ nserror llcache_query_handle_response(bool proceed, void *cbpw) if (proceed) return llcache_object_refetch(object); + /* Invalidate cache-control data */ + memset(&object->cache, 0, sizeof(llcache_cache_control)); + /* Mark it complete */ + object->fetch.state = LLCACHE_FETCH_COMPLETE; + /* Inform client(s) that object fetch failed */ event.type = LLCACHE_EVENT_ERROR; /** \todo More appropriate error message */ @@ -1601,6 +1606,7 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data, case FETCH_ERROR: /* An error occurred while fetching */ /* The fetch has has already been cleaned up by the fetcher */ + object->fetch.state = LLCACHE_FETCH_COMPLETE; object->fetch.fetch = NULL; /* Invalidate cache control data */ @@ -1639,6 +1645,11 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data, if (object->fetch.fetch != NULL) { fetch_abort(object->fetch.fetch); object->fetch.fetch = NULL; + + /* Invalidate cache control data */ + memset(&(object->cache), 0, + sizeof(llcache_cache_control)); + object->fetch.state = LLCACHE_FETCH_COMPLETE; } return; } @@ -1790,13 +1801,15 @@ nserror llcache_fetch_notmodified(llcache_object *object, /* Bring candidate's cache data up to date */ llcache_object_cache_update(object->candidate); - /* Invalidate our cache-control data */ - memset(&object->cache, 0, sizeof(llcache_cache_control)); - /* Ensure fetch has stopped */ fetch_abort(object->fetch.fetch); object->fetch.fetch = NULL; + /* Invalidate our cache-control data */ + memset(&object->cache, 0, sizeof(llcache_cache_control)); + /* Mark it complete */ + object->fetch.state = LLCACHE_FETCH_COMPLETE; + /* Candidate is now our object */ *replacement = object->candidate; @@ -2083,6 +2096,11 @@ nserror llcache_fetch_auth(llcache_object *object, const char *realm) } else { llcache_event event; + /* Invalidate cache-control data */ + memset(&object->cache, 0, sizeof(llcache_cache_control)); + /* Mark it complete */ + object->fetch.state = LLCACHE_FETCH_COMPLETE; + /* Inform client(s) that object fetch failed */ event.type = LLCACHE_EVENT_ERROR; /** \todo More appropriate error message */ @@ -2125,6 +2143,11 @@ nserror llcache_fetch_cert_error(llcache_object *object, } else { llcache_event event; + /* Invalidate cache-control data */ + memset(&object->cache, 0, sizeof(llcache_cache_control)); + /* Mark it complete */ + object->fetch.state = LLCACHE_FETCH_COMPLETE; + /* Inform client(s) that object fetch failed */ event.type = LLCACHE_EVENT_ERROR; /** \todo More appropriate error message */ |