45 |
open DonkeyThieves |
open DonkeyThieves |
46 |
open DonkeyOptions |
open DonkeyOptions |
47 |
|
|
48 |
|
let lprintf_nl () = |
49 |
|
lprintf "%s[EDK]: " |
50 |
|
(log_time ()); lprintf_nl2 |
51 |
|
|
52 |
let _ = |
let _ = |
53 |
network.op_network_is_enabled <- (fun _ -> !!enable_donkey); |
network.op_network_is_enabled <- (fun _ -> !!enable_donkey); |
78 |
DonkeySources.connect_sources connection_manager; |
DonkeySources.connect_sources connection_manager; |
79 |
with e -> |
with e -> |
80 |
if !verbose_sources > 2 then |
if !verbose_sources > 2 then |
81 |
lprintf_nl "Exception %s while checking sources" |
lprintf_nl () "Exception %s while checking sources" |
82 |
(Printexc2.to_string e) |
(Printexc2.to_string e) |
83 |
) |
) |
84 |
|
|
207 |
if Unix32.file_exists file_disk_name && |
if Unix32.file_exists file_disk_name && |
208 |
Unix32.getsize file_disk_name false <> Int64.zero then begin |
Unix32.getsize file_disk_name false <> Int64.zero then begin |
209 |
(* getsize writable=false is ok because file has state FileDownloaded *) |
(* getsize writable=false is ok because file has state FileDownloaded *) |
210 |
lprintf_nl "FILE DOWNLOADED"; |
lprintf_nl () "FILE DOWNLOADED"; |
211 |
|
|
212 |
DonkeyOneFile.declare_completed_file file; |
DonkeyOneFile.declare_completed_file file; |
213 |
end |
end |
216 |
file_commit (as_file file) |
file_commit (as_file file) |
217 |
end |
end |
218 |
with e -> |
with e -> |
219 |
lprintf_nl "Exception %s while recovering download %s" |
lprintf_nl () "Exception %s while recovering download %s" |
220 |
(Printexc2.to_string e) (file_disk_name file); |
(Printexc2.to_string e) (file_disk_name file); |
221 |
) files_by_md4; |
) files_by_md4; |
222 |
|
|
259 |
udp_sock := Some sock; |
udp_sock := Some sock; |
260 |
UdpSocket.set_write_controler sock udp_write_controler; |
UdpSocket.set_write_controler sock udp_write_controler; |
261 |
with e -> |
with e -> |
262 |
lprintf_nl "Exception %s while binding UDP socket" |
lprintf_nl () "Exception %s while binding UDP socket" |
263 |
(Printexc2.to_string e); |
(Printexc2.to_string e); |
264 |
end; |
end; |
265 |
sock |
sock |
331 |
*) |
*) |
332 |
|
|
333 |
with e -> |
with e -> |
334 |
lprintf_nl "Error: Exception %s during startup" |
lprintf_nl () "Error: Exception %s during startup" |
335 |
(Printexc2.to_string e) |
(Printexc2.to_string e) |
336 |
|
|
337 |
let _ = |
let _ = |
378 |
let s = File.to_string file in |
let s = File.to_string file in |
379 |
let t = K.read s in |
let t = K.read s in |
380 |
K.print t; |
K.print t; |
381 |
lprintf_nl ""; |
lprint_newline (); |
382 |
), " <filename> : print a known.met file"; |
), " <filename> : print a known.met file"; |
383 |
"-part", Arg.String (fun file -> |
"-part", Arg.String (fun file -> |
384 |
let module K = DonkeyImport.Part in |
let module K = DonkeyImport.Part in |
385 |
let s = File.to_string file in |
let s = File.to_string file in |
386 |
let t = K.read s in |
let t = K.read s in |
387 |
K.print t; |
K.print t; |
388 |
lprintf_nl ""; |
lprint_newline (); |
389 |
), " <filename> : print a .part.met file"; |
), " <filename> : print a .part.met file"; |
390 |
"-server", Arg.String (fun file -> |
"-server", Arg.String (fun file -> |
391 |
let module K = DonkeyImport.Server in |
let module K = DonkeyImport.Server in |
392 |
let s = File.to_string file in |
let s = File.to_string file in |
393 |
let t = K.read s in |
let t = K.read s in |
394 |
K.print t; |
K.print t; |
395 |
lprintf_nl ""; |
lprint_newline (); |
396 |
exit 0 |
exit 0 |
397 |
), " <filename> : print a server.met file"; |
), " <filename> : print a server.met file"; |
398 |
"-pref", Arg.String (fun file -> |
"-pref", Arg.String (fun file -> |
400 |
let s = File.to_string file in |
let s = File.to_string file in |
401 |
let t = K.read s in |
let t = K.read s in |
402 |
K.print t; |
K.print t; |
403 |
lprintf_nl ""; |
lprint_newline (); |
404 |
), " <filename> : print a server.met file"; |
), " <filename> : print a server.met file"; |
405 |
"-peers", Arg.String (fun file -> |
"-peers", Arg.String (fun file -> |
406 |
let module K = DonkeyOvernetImport.Peer in |
let module K = DonkeyOvernetImport.Peer in |
407 |
let s = File.to_string file in |
let s = File.to_string file in |
408 |
let t = K.read s in |
let t = K.read s in |
409 |
K.print t; |
K.print t; |
410 |
lprintf_nl ""; |
lprint_newline (); |
411 |
exit 0 |
exit 0 |
412 |
), " <filename> : print a contact.dat file"; |
), " <filename> : print a contact.dat file"; |
413 |
] |
] |