/[mldonkey]/mldonkey/src/networks/bittorrent/bTChooser.ml
ViewVC logotype

Diff of /mldonkey/src/networks/bittorrent/bTChooser.ml

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

revision 1.8 by spiralvoice, Sun Jul 10 23:19:16 2005 UTC revision 1.9 by spiralvoice, Fri Jul 22 14:32:12 2005 UTC
# Line 32  open BTTypes Line 32  open BTTypes
32  open BTOptions  open BTOptions
33  open BTGlobals  open BTGlobals
34    
35    (* prints a new logline with date, module and starts newline *)
36    let lprintf_nl () =
37      lprintf "%s[BT] "
38        (log_time ()); lprintf_nl2
39    
40    (* prints a new logline with date, module and does not start newline *)
41    let lprintf_n () =
42      lprintf "%s[BT] "
43        (log_time ()); lprintf
44    
45  (*given some files choose the next uploaders based on their behavior  (*given some files choose the next uploaders based on their behavior
46    Will choose max_uploaders_per_torrent uploaders for each file in list    Will choose max_uploaders_per_torrent uploaders for each file in list
# Line 58  let choose_next_uploaders files fun_comp Line 67  let choose_next_uploaders files fun_comp
67              possible_uploaders := (c::!possible_uploaders);              possible_uploaders := (c::!possible_uploaders);
68            end )  f.file_clients;            end )  f.file_clients;
69        if !verbose_upload then        if !verbose_upload then
70            lprintf_nl "[BT]: clients num %d as possible uploaders for file %s\n" (List.length !possible_uploaders) f.file_name;            lprintf_nl () "clients num %d as possible uploaders for file %s" (List.length !possible_uploaders) f.file_name;
71        (*Interested clients with a connection*)        (*Interested clients with a connection*)
72        let filtl = List.filter (fun c -> c.client_interested == true        let filtl = List.filter (fun c -> c.client_interested == true
73              && (c.client_sock != NoConnection)              && (c.client_sock != NoConnection)
# Line 82  let choose_next_uploaders files fun_comp Line 91  let choose_next_uploaders files fun_comp
91        full_list := !full_list @ to_add;        full_list := !full_list @ to_add;
92        if !verbose_upload then        if !verbose_upload then
93          begin          begin
94            lprintf "[BT]: potential uploaders count: %d list: [" (List.length to_add);            lprintf_n () "potential uploaders count: %d list: [" (List.length to_add);
95            List.iter (fun cr ->            List.iter (fun cr ->
96                let (ip,port) = cr.client_host in                let (ip,port) = cr.client_host in
97                    lprintf " %s:%d" (Ip.to_string ip) port;                    lprintf " %s:%d" (Ip.to_string ip) port;
98               ) to_add;               ) to_add;
99            lprintf_nl " ]";            lprintf_nl2 " ]";
100          end;          end;
101    
102    ) files;    ) files;
# Line 131  let choose_uploaders files = Line 140  let choose_uploaders files =
140    begin    begin
141      if !verbose_upload then      if !verbose_upload then
142          begin          begin
143            lprintf "[BT]: next_uploaders: %d list: [" (List.length next_uploaders);            lprintf_n () "next_uploaders: %d list: [" (List.length next_uploaders);
144            List.iter (fun cr ->            List.iter (fun cr ->
145                let (ip,port) = cr.client_host in                let (ip,port) = cr.client_host in
146                    lprintf " %s:%d" (Ip.to_string ip) port;                    lprintf " %s:%d" (Ip.to_string ip) port;
147               ) next_uploaders;               ) next_uploaders;
148            lprintf_nl " ]";            lprintf_nl2 " ]";
149          end;          end;
150      if (List.length next_uploaders) > !!max_bt_uploaders then      if (List.length next_uploaders) > !!max_bt_uploaders then
151          let keep,rest = List2.cut !!max_bt_uploaders next_uploaders in          let keep,rest = List2.cut !!max_bt_uploaders next_uploaders in
152          begin          begin
153            if !verbose_upload then            if !verbose_upload then
154               begin               begin
155                 lprintf "[BT]: cut next_uploaders: %d list: [" (List.length keep);                 lprintf_n () "cut next_uploaders: %d list: [" (List.length keep);
156                 List.iter (fun cr ->                 List.iter (fun cr ->
157                      let (ip,port) = cr.client_host in                      let (ip,port) = cr.client_host in
158                          lprintf " %s:%d" (Ip.to_string ip) port;                          lprintf " %s:%d" (Ip.to_string ip) port;
159                     ) keep;                     ) keep;
160                 lprintf_nl " ]";                 lprintf_nl2 " ]";
161               end;               end;
162            keep            keep
163          end          end

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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