1805 |
(* *) |
(* *) |
1806 |
(*************************************************************************) |
(*************************************************************************) |
1807 |
|
|
|
let max_clients_per_block = 3 |
|
|
|
|
1808 |
let permute_and_return up n = |
let permute_and_return up n = |
1809 |
let b = up.up_complete_blocks.(n) in |
let b = up.up_complete_blocks.(n) in |
1810 |
if debug_all then lprintf "permute_and_return %d <> %d" n b; |
if debug_all then lprintf "permute_and_return %d <> %d" n b; |
2115 |
(************* Fall back on linear download if nothing worked *) |
(************* Fall back on linear download if nothing worked *) |
2116 |
|
|
2117 |
in |
in |
2118 |
iter_max_uploaders 1; |
iter_max_uploaders !!sources_per_chunk; |
|
iter_max_uploaders max_clients_per_block; |
|
2119 |
iter_max_uploaders max_int; |
iter_max_uploaders max_int; |
2120 |
raise Not_found |
raise Not_found |
2121 |
with |
with |
2274 |
| Some rr -> iter limit rr |
| Some rr -> iter limit rr |
2275 |
in |
in |
2276 |
try |
try |
|
(* first try to find ranges with 0 uploaders *) |
|
|
iter 1 r |
|
|
with Not_found -> |
|
|
try |
|
2277 |
(* try normal ranges *) |
(* try normal ranges *) |
2278 |
iter max_clients_per_block r |
iter !!sources_per_chunk r |
2279 |
with Not_found -> |
with Not_found -> |
2280 |
(* force maximal uploading otherwise to finish it *) |
(* force maximal uploading otherwise to finish it *) |
2281 |
iter max_int r |
iter max_int r |
2282 |
|
|
2283 |
(*************************************************************************) |
(*************************************************************************) |
2284 |
(* *) |
(* *) |