208 |
new_client impl; |
new_client impl; |
209 |
Hashtbl.add clients_by_uid key c; |
Hashtbl.add clients_by_uid key c; |
210 |
c |
c |
211 |
|
|
212 |
let add_download file c url = |
let add_download file c url referer = |
213 |
(* let r = new_result file.file_name (file_size file) in *) |
(* let r = new_result file.file_name (file_size file) in *) |
214 |
(* add_source r c.client_user index; *) |
(* add_source r c.client_user index; *) |
215 |
if !verbose then lprintf "Adding file to client\n"; |
if !verbose then lprintf "Adding file to client\n"; |
221 |
c.client_downloads <- c.client_downloads @ [{ |
c.client_downloads <- c.client_downloads @ [{ |
222 |
download_file = file; |
download_file = file; |
223 |
download_url = url; |
download_url = url; |
224 |
|
download_referer = referer; |
225 |
download_chunks = chunks; |
download_chunks = chunks; |
226 |
download_uploader = None; |
download_uploader = None; |
227 |
download_ranges = []; |
download_ranges = []; |
241 |
| d :: tail -> |
| d :: tail -> |
242 |
if d.download_file == file then d else find_download file tail |
if d.download_file == file then d else find_download file tail |
243 |
|
|
244 |
|
|
245 |
let rec find_download_by_index index list = |
let rec find_download_by_index index list = |
246 |
match list with |
match list with |
247 |
[] -> raise Not_found |
[] -> raise Not_found |
277 |
let set_client_disconnected client = |
let set_client_disconnected client = |
278 |
CommonClient.set_client_disconnected (as_client client) |
CommonClient.set_client_disconnected (as_client client) |
279 |
|
|
280 |
|
|
281 |
let remove_file file = |
let remove_file file = |
282 |
Hashtbl.remove files_by_uid file.file_id; |
Hashtbl.remove files_by_uid file.file_id; |
283 |
current_files := List2.removeq file !current_files |
current_files := List2.removeq file !current_files |
292 |
let ft_client_name = ref "" |
let ft_client_name = ref "" |
293 |
|
|
294 |
let client_name () = |
let client_name () = |
|
|
|
295 |
let name = !!global_login in |
let name = !!global_login in |
296 |
if name != !old_client_name then begin |
if name != !old_client_name then begin |
297 |
let len = String.length name in |
let len = String.length name in |