1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-30 03:26:23 -04: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:
Jonas Fonseca 2006-02-03 10:44:29 +01:00 committed by Jonas Fonseca
parent c2d5464910
commit 33625ae9e2

View File

@ -995,14 +995,13 @@ change_connection(struct download *old, struct download *new,
assertm(conn->pri[old->pri] >= 0, "priority counter underflow"); assertm(conn->pri[old->pri] >= 0, "priority counter underflow");
if_assert_failed conn->pri[old->pri] = 0; if_assert_failed conn->pri[old->pri] = 0;
conn->pri[newpri]++;
del_from_list(old); del_from_list(old);
old->state = S_INTERRUPTED; old->state = S_INTERRUPTED;
if (new) { if (list_empty(conn->downloads)) {
add_to_list(conn->downloads, new); /* Necessary because of assertion in get_priority(). */
conn->pri[PRI_CANCEL]++;
} else {
if (conn->detached || interrupt) if (conn->detached || interrupt)
abort_connection(conn, S_INTERRUPTED); abort_connection(conn, S_INTERRUPTED);
} }
@ -1041,6 +1040,9 @@ move_download(struct download *old, struct download *new,
return; return;
} }
conn->pri[new->pri]++;
add_to_list(conn->downloads, new);
change_connection(old, new, newpri, 0); change_connection(old, new, newpri, 0);
} }