762 |
Int64Swarmer.downloaded swarmer in |
Int64Swarmer.downloaded swarmer in |
763 |
|
|
764 |
(*Update rate and amount of data received from client*) |
(*Update rate and amount of data received from client*) |
765 |
c.client_downloaded <- c.client_downloaded ++ |
count_download c file (new_downloaded -- old_downloaded); |
|
(new_downloaded -- old_downloaded); |
|
766 |
(* use len here with max_dr quickfix *) |
(* use len here with max_dr quickfix *) |
767 |
Rate.update c.client_downloaded_rate (float_of_int len); |
Rate.update c.client_downloaded_rate (float_of_int len); |
|
(* update the stats *) |
|
|
let len64 = Int64.of_int len in |
|
|
count_download c file len64; |
|
768 |
network_must_update network; |
network_must_update network; |
769 |
if !verbose_msg_clients then |
if !verbose_msg_clients then |
770 |
(match c.client_ranges_sent with |
(match c.client_ranges_sent with |
1450 |
let file = c.client_file in |
let file = c.client_file in |
1451 |
let offset = pos ++ file.file_piece_size *.. num in |
let offset = pos ++ file.file_piece_size *.. num in |
1452 |
c.client_allowed_to_write <- c.client_allowed_to_write -- len; |
c.client_allowed_to_write <- c.client_allowed_to_write -- len; |
1453 |
c.client_uploaded <- c.client_uploaded ++ len; |
count_upload c file len; |
1454 |
let len = Int64.to_int len in |
let len = Int64.to_int len in |
1455 |
CommonUploads.consume_bandwidth len; |
CommonUploads.consume_bandwidth len; |
1456 |
(* lprintf "Unix32.read: offset %Ld len %d\n" offset len; *) |
(* lprintf "Unix32.read: offset %Ld len %d\n" offset len; *) |
1457 |
Unix32.read (file_fd file) offset upload_buffer 0 len; |
Unix32.read (file_fd file) offset upload_buffer 0 len; |
1458 |
(* update upload rate from len bytes *) |
(* update upload rate from len bytes *) |
1459 |
(* will be reverted to len instead of len / 2 when rate bug will be fixed *) |
Rate.update c.client_upload_rate (float_of_int len); |
|
Rate.update c.client_upload_rate (float_of_int (len / 2)); |
|
1460 |
file.file_uploaded <- file.file_uploaded ++ (Int64.of_int len); |
file.file_uploaded <- file.file_uploaded ++ (Int64.of_int len); |
1461 |
let _ = |
let _ = |
1462 |
(* update stats *) |
(* update stats *) |
1471 |
in |
in |
1472 |
(* lprintf "sending piece\n"; *) |
(* lprintf "sending piece\n"; *) |
1473 |
send_client c (Piece (num, pos, upload_buffer, 0, len)); |
send_client c (Piece (num, pos, upload_buffer, 0, len)); |
|
(* update stats *) |
|
|
let uploaded = Int64.of_int len in |
|
|
count_upload c file uploaded; |
|
1474 |
network_must_update network; |
network_must_update network; |
1475 |
iter_upload sock c |
iter_upload sock c |
1476 |
end else |
end else |