mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Don't check is_in_progress_state before calling cancel_download
With commit 637f1e82e6
('NET: Merge
change_connection into cancel_download'), cancel_download returns
immediately if the connection is not in a result state, so save some
code by not checking is_in_progress_state before calling cancel_download.
This commit is contained in:
parent
2c087e52e7
commit
daad05c055
@ -351,7 +351,6 @@ 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);
|
||||
|
||||
download->state = S_WAIT_REDIR;
|
||||
@ -427,7 +426,6 @@ 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);
|
||||
|
||||
mem_free(fetcher);
|
||||
|
@ -140,7 +140,6 @@ 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);
|
||||
if (file_download->uri) done_uri(file_download->uri);
|
||||
|
||||
@ -389,7 +388,6 @@ 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);
|
||||
|
||||
assertm(compare_uri(cached->uri, file_download->uri, 0),
|
||||
@ -899,7 +897,6 @@ 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);
|
||||
|
||||
object_unlock(type_query->cached);
|
||||
|
@ -1123,7 +1123,6 @@ 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);
|
||||
abort_files_load(ses, interrupt);
|
||||
}
|
||||
|
@ -206,7 +206,6 @@ 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);
|
||||
|
||||
load_uri(uri, cached->uri, download, PRI_MAIN, 0, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user