mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
NET: Move attaching of new download to move_download
This includes setting the new priority and adding the download to the list of connection downloads. If the connection has no downloads set the PRI_CANCEL priority; get_priority() requires that.
This commit is contained in:
parent
c2d5464910
commit
33625ae9e2
@ -995,14 +995,13 @@ change_connection(struct download *old, struct download *new,
|
||||
assertm(conn->pri[old->pri] >= 0, "priority counter underflow");
|
||||
if_assert_failed conn->pri[old->pri] = 0;
|
||||
|
||||
conn->pri[newpri]++;
|
||||
del_from_list(old);
|
||||
old->state = S_INTERRUPTED;
|
||||
|
||||
if (new) {
|
||||
add_to_list(conn->downloads, new);
|
||||
if (list_empty(conn->downloads)) {
|
||||
/* Necessary because of assertion in get_priority(). */
|
||||
conn->pri[PRI_CANCEL]++;
|
||||
|
||||
} else {
|
||||
if (conn->detached || interrupt)
|
||||
abort_connection(conn, S_INTERRUPTED);
|
||||
}
|
||||
@ -1041,6 +1040,9 @@ move_download(struct download *old, struct download *new,
|
||||
return;
|
||||
}
|
||||
|
||||
conn->pri[new->pri]++;
|
||||
add_to_list(conn->downloads, new);
|
||||
|
||||
change_connection(old, new, newpri, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user