58 |
possible_uploaders := (c::!possible_uploaders); |
possible_uploaders := (c::!possible_uploaders); |
59 |
end ) f.file_clients; |
end ) f.file_clients; |
60 |
if !verbose_upload then |
if !verbose_upload then |
61 |
lprintf "clients num %d as possible uploaders for file %s\n" (List.length !possible_uploaders) f.file_name; |
lprintf_nl "[BT]: clients num %d as possible uploaders for file %s\n" (List.length !possible_uploaders) f.file_name; |
62 |
(*Interested clients with a connection*) |
(*Interested clients with a connection*) |
63 |
let filtl = List.filter (fun c -> c.client_interested == true |
let filtl = List.filter (fun c -> c.client_interested == true |
64 |
&& (c.client_sock != NoConnection) |
&& (c.client_sock != NoConnection) |
82 |
full_list := !full_list @ to_add; |
full_list := !full_list @ to_add; |
83 |
if !verbose_upload then |
if !verbose_upload then |
84 |
begin |
begin |
85 |
lprintf " potential uploaders count: %d list:" (List.length to_add); |
lprintf "[BT]: potential uploaders count: %d list: [" (List.length to_add); |
86 |
List.iter (fun cr -> |
List.iter (fun cr -> |
87 |
let (ip,port) = cr.client_host in |
let (ip,port) = cr.client_host in |
88 |
lprintf " %s:%d" (Ip.to_string ip) port; |
lprintf " %s:%d" (Ip.to_string ip) port; |
89 |
) to_add; |
) to_add; |
90 |
lprintf "\n"; |
lprintf_nl " ]"; |
91 |
end; |
end; |
92 |
|
|
93 |
) files; |
) files; |
131 |
begin |
begin |
132 |
if !verbose_upload then |
if !verbose_upload then |
133 |
begin |
begin |
134 |
lprintf "next_uploaders: %d List:" (List.length next_uploaders); |
lprintf "[BT]: next_uploaders: %d list: [" (List.length next_uploaders); |
135 |
List.iter (fun cr -> |
List.iter (fun cr -> |
136 |
let (ip,port) = cr.client_host in |
let (ip,port) = cr.client_host in |
137 |
lprintf " %s:%d" (Ip.to_string ip) port; |
lprintf " %s:%d" (Ip.to_string ip) port; |
138 |
) next_uploaders; |
) next_uploaders; |
139 |
lprintf "\n"; |
lprintf_nl " ]"; |
140 |
end; |
end; |
141 |
if (List.length next_uploaders) > !!max_bt_uploaders then |
if (List.length next_uploaders) > !!max_bt_uploaders then |
142 |
let keep,rest = List2.cut !!max_bt_uploaders next_uploaders in |
let keep,rest = List2.cut !!max_bt_uploaders next_uploaders in |
143 |
begin |
begin |
144 |
if !verbose_upload then |
if !verbose_upload then |
145 |
begin |
begin |
146 |
lprintf "cut next_uploaders: %d List:" (List.length keep); |
lprintf "[BT]: cut next_uploaders: %d list: [" (List.length keep); |
147 |
List.iter (fun cr -> |
List.iter (fun cr -> |
148 |
let (ip,port) = cr.client_host in |
let (ip,port) = cr.client_host in |
149 |
lprintf " %s:%d" (Ip.to_string ip) port; |
lprintf " %s:%d" (Ip.to_string ip) port; |
150 |
) keep; |
) keep; |
151 |
lprintf "\n"; |
lprintf_nl " ]"; |
152 |
end; |
end; |
153 |
keep |
keep |
154 |
end |
end |