824 |
let force_download_quotas () = |
let force_download_quotas () = |
825 |
let files = List.sort (fun f1 f2 -> |
let files = List.sort (fun f1 f2 -> |
826 |
let v = file_priority f2 - file_priority f1 in |
let v = file_priority f2 - file_priority f1 in |
827 |
if v <> 0 then v else |
if v <> 0 then v else begin |
828 |
(* Try to download in priority files with fewer bytes missing |
(** |
829 |
Rationale: once completed, it may allow to recover some disk space *) |
* [egs] do not start downloading |
830 |
let r1 = file_size f1 -- file_downloaded f1 in |
* a small file against an already active download |
831 |
let r2 = file_size f2 -- file_downloaded f2 in |
**) |
832 |
if r1 = r2 then 0 else |
let d1 = file_downloaded f1 in |
833 |
if r2 < r1 then 1 else -1 |
let d2 = file_downloaded f2 in |
834 |
) |
if (d1=0L ) && (d2 > 0L) |
835 |
|
then 1 |
836 |
|
else if ( d2=0L ) && (d1 > 0L) |
837 |
|
then -1 |
838 |
|
else begin |
839 |
|
(* Try to download in priority files with fewer bytes missing |
840 |
|
Rationale: once completed, it may allow to recover some disk space *) |
841 |
|
let r1 = file_size f1 -- d1 in |
842 |
|
let r2 = file_size f2 -- d2 in |
843 |
|
if r1 = r2 then 0 else |
844 |
|
if r2 < r1 then 1 else -1 |
845 |
|
end |
846 |
|
end |
847 |
|
) |
848 |
!!CommonComplexOptions.files in |
!!CommonComplexOptions.files in |
849 |
|
|
850 |
let rec iter list priority files ndownloads nqueued = |
let rec iter list priority files ndownloads nqueued = |