1138 |
(* *) |
(* *) |
1139 |
(*************************************************************************) |
(*************************************************************************) |
1140 |
|
|
|
let max_clients_per_block = 3 |
|
|
|
|
1141 |
let permute_and_return up n = |
let permute_and_return up n = |
1142 |
let b = up.up_complete_blocks.(n) in |
let b = up.up_complete_blocks.(n) in |
1143 |
if debug_all then lprintf "permute_and_return %d <> %d" n b; |
if debug_all then lprintf "permute_and_return %d <> %d" n b; |
1368 |
(************* Fall back on linear download if nothing worked *) |
(************* Fall back on linear download if nothing worked *) |
1369 |
|
|
1370 |
in |
in |
1371 |
iter_max_uploaders 1; |
iter_max_uploaders !!sources_per_chunk; |
|
iter_max_uploaders max_clients_per_block; |
|
1372 |
iter_max_uploaders max_int; |
iter_max_uploaders max_int; |
1373 |
raise Not_found |
raise Not_found |
1374 |
with |
with |
1520 |
| Some rr -> iter limit rr |
| Some rr -> iter limit rr |
1521 |
in |
in |
1522 |
try |
try |
|
(* first try to find ranges with 0 uploaders *) |
|
|
iter 1 r |
|
|
with Not_found -> |
|
|
try |
|
1523 |
(* try normal ranges *) |
(* try normal ranges *) |
1524 |
iter max_clients_per_block r |
iter !!sources_per_chunk r |
1525 |
with Not_found -> |
with Not_found -> |
1526 |
(* force maximal uploading otherwise to finish it *) |
(* force maximal uploading otherwise to finish it *) |
1527 |
iter max_int r |
iter max_int r |
1528 |
|
|
1529 |
(*************************************************************************) |
(*************************************************************************) |
1530 |
(* *) |
(* *) |