diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-07-02 14:50:23 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-07-02 14:51:11 +0100 |
commit | 516dcb96e111c6e1e0c1503ac156497aa15894d6 (patch) | |
tree | acc79e3f65e8fef061d493358a43c6d4ecc7be45 | |
parent | c574780d29dde43fbf8fdfc2e6465e98ff0f3e10 (diff) | |
download | netsurf-516dcb96e111c6e1e0c1503ac156497aa15894d6.tar.gz netsurf-516dcb96e111c6e1e0c1503ac156497aa15894d6.tar.bz2 |
fix unhelpful assert at quit
-rw-r--r-- | content/fetch.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/content/fetch.c b/content/fetch.c index 3d1183aa0..abfdf4c97 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -290,9 +290,28 @@ void fetcher_quit(void) { int fetcherd; /* fetcher index */ for (fetcherd = 0; fetcherd < MAX_FETCHERS; fetcherd++) { - if (fetchers[fetcherd].refcount > 0) { - /* assert if the fetcher is active at quit */ - assert(fetchers[fetcherd].refcount == 1); + if (fetchers[fetcherd].refcount > 1) { + /* fetcher still has reference at quit. This + * should not happen as the fetch should have + * been aborted in llcache shutdown. + * + * This appears to be normal behaviour if a + * curl operation is still in progress at exit + * as the abort waits for curl to complete. + * + * We could make the user wait for curl to + * complete but we are exiting anyway so thats + * unhelpful. Instead we just log it and force + * the reference count to allow the fetcher to + * be stopped. + */ + LOG(("Fetcher for scheme %s still has %d active users at quit.", + lwc_string_data(fetchers->scheme_name), + fetchers->refcount)); + + fetchers->refcount = 1; + } + if (fetchers[fetcherd].refcount == 1) { fetch_unref_fetcher(fetcherd); } |