/[mldonkey]/mldonkey/src/networks/donkey/donkeyFiles.ml
ViewVC logotype

Diff of /mldonkey/src/networks/donkey/donkeyFiles.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by spiralvoice, Mon Aug 15 20:27:56 2005 UTC revision 1.14 by spiralvoice, Thu Oct 6 19:16:43 2005 UTC
# Line 47  open DonkeyStats Line 47  open DonkeyStats
47    
48  let verbose_upload = false  let verbose_upload = false
49                
50  let msg_block_size_int = 10000  let msg_block_size_int = 10240
51  let msg_block_size = Int64.of_int msg_block_size_int  let msg_block_size = Int64.of_int msg_block_size_int
52  let upload_buffer = String.create msg_block_size_int  let upload_buffer = String.create msg_block_size_int
53  let max_msg_size = 15000  let max_msg_size = 15000
# Line 78  module NewUpload = struct Line 78  module NewUpload = struct
78      let rec send_small_block c sock file begin_pos len_int =      let rec send_small_block c sock file begin_pos len_int =
79  (*      lprintf "send_small_block %d\n" len_int; *)  (*      lprintf "send_small_block %d\n" len_int; *)
80  (*      let len_int = Int32.to_int len in *)  (*      let len_int = Int32.to_int len in *)
       CommonUploads.consume_bandwidth len_int;  
81        try        try
82          if !verbose then begin          if !verbose then begin
83              lprintf "send_small_block(%s-%s) %Ld %d\n"              lprintf "send_small_block(%s-%s) %Ld %d\n"
# Line 107  module NewUpload = struct Line 106  module NewUpload = struct
106          Unix32.read (file_fd file) begin_pos upload_buffer slen len_int;          Unix32.read (file_fd file) begin_pos upload_buffer slen len_int;
107          let uploaded = Int64.of_int len_int in          let uploaded = Int64.of_int len_int in
108          count_upload c file uploaded;          count_upload c file uploaded;
109            CommonUploads.consume_bandwidth len_int;
110          network_must_update network;          network_must_update network;
111          (match file.file_shared with None -> ()          (match file.file_shared with None -> ()
112            | Some impl ->            | Some impl ->
# Line 125  module NewUpload = struct Line 125  module NewUpload = struct
125            
126      let rec send_client_block c sock per_client =      let rec send_client_block c sock per_client =
127  (*      lprintf "send_client_block\n"; *)  (*      lprintf "send_client_block\n"; *)
128        if per_client > 0 && CommonUploads.remaining_bandwidth () > 0 then        if per_client > 0 && CommonUploads.can_write_len sock max_msg_size then
129          match c.client_upload with          match c.client_upload with
130          | Some ({ up_chunks = _ :: chunks } as up)  ->          | Some ({ up_chunks = _ :: chunks } as up)  ->
131              if up.up_file.file_shared = None then begin              if up.up_file.file_shared = None then begin
# Line 163  module NewUpload = struct Line 163  module NewUpload = struct
163                  up.up_pos <- Int64.add up.up_pos                  up.up_pos <- Int64.add up.up_pos
164                    (Int64.of_int msg_block_size_int);                    (Int64.of_int msg_block_size_int);
165                  let per_client = per_client-msg_block_size_int in                  let per_client = per_client-msg_block_size_int in
166                  if can_write_len sock max_msg_size then                  send_client_block c sock per_client
                   send_client_block c sock per_client  
167                end                end
168          | _ -> ()          | _ -> ()
169            
# Line 173  module NewUpload = struct Line 172  module NewUpload = struct
172        do_if_connected  c.client_source.DonkeySources.source_sock (fun sock ->        do_if_connected  c.client_source.DonkeySources.source_sock (fun sock ->
173  (*    lprintf "upload_to_client %d connected\n"  (maxi max_msg_size size); *)  (*    lprintf "upload_to_client %d connected\n"  (maxi max_msg_size size); *)
174                        
 (* changed in 2.5.27: mini instead of maxi *)  
175            let size = mini max_msg_size size in            let size = mini max_msg_size size in
176            if CommonUploads.can_write_len sock size then            send_client_block c sock size;
177              begin             (match c.client_upload with
 (*              lprintf "can_write_len %d\n"  (maxi max_msg_size size); *)  
               send_client_block c sock size;  
             end;  
           (match c.client_upload with  
178                None -> ()                None -> ()
179              | Some up ->              | Some up ->
180                  if !CommonUploads.has_upload = 0 then                  if !CommonUploads.has_upload = 0 then

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26