fixup! refactor: GTK favicon lookup improvements (#4278) (#4286)

This commit is contained in:
Charles Kerr 2022-11-30 14:51:38 -06:00 committed by GitHub
parent e038121857
commit c4b290586e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -83,6 +83,11 @@ Glib::RefPtr<Gdk::Pixbuf> favicon_load_from_cache(std::string const& host)
void favicon_web_done_cb(tr_web::FetchResponse const& response);
constexpr bool should_keep_trying(long code)
{
return code != 0 && code <= 500;
}
bool favicon_web_done_idle_cb(std::unique_ptr<favicon_data> fav)
{
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
@ -93,7 +98,7 @@ bool favicon_web_done_idle_cb(std::unique_ptr<favicon_data> fav)
pixbuf = favicon_load_from_cache(fav->host);
}
if (fav->code == 404 && pixbuf == nullptr && ++fav->type < ImageTypes.size()) /* keep trying */
if (pixbuf == nullptr && should_keep_trying(fav->code) && ++fav->type < ImageTypes.size()) /* keep trying */
{
fav->contents.clear();
auto* const session = fav->session;