diff --git a/src/protocol/bittorrent/common.c b/src/protocol/bittorrent/common.c index 63ade24d7..11d8555de 100644 --- a/src/protocol/bittorrent/common.c +++ b/src/protocol/bittorrent/common.c @@ -351,8 +351,7 @@ bittorrent_fetch_callback(struct download *download, void *data) return; if (cached->redirect && fetcher->redirects++ < MAX_REDIRECTS) { - if (is_in_progress_state(download->state)) - cancel_download(download, 0); + cancel_download(download, 0); download->state = S_WAIT_REDIR; @@ -427,8 +426,7 @@ end_bittorrent_fetch(void *fetcher_data) assert(fetcher && !fetcher->callback); /* Stop any running connections. */ - if (is_in_progress_state(fetcher->download.state)) - cancel_download(&fetcher->download, 0); + cancel_download(&fetcher->download, 0); mem_free(fetcher); } diff --git a/src/session/download.c b/src/session/download.c index bc6f732e7..19ada20c5 100644 --- a/src/session/download.c +++ b/src/session/download.c @@ -140,8 +140,7 @@ abort_download(struct file_download *file_download) if (file_download->dlg_data) cancel_dialog(file_download->dlg_data, NULL); - if (is_in_progress_state(file_download->download.state)) - cancel_download(&file_download->download, file_download->stop); + cancel_download(&file_download->download, file_download->stop); if (file_download->uri) done_uri(file_download->uri); if (file_download->handle != -1) { @@ -389,8 +388,7 @@ download_data(struct download *download, struct file_download *file_download) file_download->remotetime = parse_date(&cached->last_modified, NULL, 0, 1); if (cached->redirect && file_download->redirect_cnt++ < MAX_REDIRECTS) { - if (is_in_progress_state(download->state)) - cancel_download(&file_download->download, 0); + cancel_download(&file_download->download, 0); assertm(compare_uri(cached->uri, file_download->uri, 0), "Redirecting using bad base URI"); @@ -899,8 +897,7 @@ void done_type_query(struct type_query *type_query) { /* Unregister any active download */ - if (is_in_progress_state(type_query->download.state)) - cancel_download(&type_query->download, 0); + cancel_download(&type_query->download, 0); object_unlock(type_query->cached); done_uri(type_query->uri); diff --git a/src/session/session.c b/src/session/session.c index 37845b9eb..99cc9fb04 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -1123,8 +1123,7 @@ abort_loading(struct session *ses, int interrupt) if (have_location(ses)) { struct location *loc = cur_loc(ses); - if (is_in_progress_state(loc->download.state)) - cancel_download(&loc->download, interrupt); + cancel_download(&loc->download, interrupt); abort_files_load(ses, interrupt); } abort_preloading(ses, interrupt); diff --git a/src/viewer/dump/dump.c b/src/viewer/dump/dump.c index 48208eb62..dc12ca5c9 100644 --- a/src/viewer/dump/dump.c +++ b/src/viewer/dump/dump.c @@ -206,8 +206,7 @@ dump_loading_callback(struct download *download, void *p) if (cached && cached->redirect && dump_redir_count++ < MAX_REDIRECTS) { struct uri *uri = cached->redirect; - if (is_in_progress_state(download->state)) - cancel_download(download, 0); + cancel_download(download, 0); load_uri(uri, cached->uri, download, PRI_MAIN, 0, -1); return;