255 |
in |
in |
256 |
if not exists_downloads_ini then |
if not exists_downloads_ini then |
257 |
begin |
begin |
|
lprintf "No config file (downloads.ini) found. Generating one.\n"; |
|
258 |
let oc = open_out (options_file_name downloads_ini) in |
let oc = open_out (options_file_name downloads_ini) in |
259 |
close_out oc; |
close_out oc; |
260 |
if not exists_users_ini then |
if not exists_users_ini then |
261 |
begin |
begin |
|
lprintf "No config file (users.ini) found. Generating one.\n"; |
|
262 |
let oc = open_out (options_file_name users_ini) in |
let oc = open_out (options_file_name users_ini) in |
263 |
close_out oc; |
close_out oc; |
264 |
end; |
end; |
426 |
let t = Unix.localtime (Unix.time ()) in |
let t = Unix.localtime (Unix.time ()) in |
427 |
if (t.Unix.tm_year<=104) then |
if (t.Unix.tm_year<=104) then |
428 |
begin |
begin |
429 |
lprintf "\n\n\nYour system has a system date earlier than 2004, please correct it.\n"; |
lprintf (_b "\n\n\nYour system has a system date earlier than 2004, please correct it.\n"); |
430 |
lprintf "MLdonkey can not work with such a system date, exiting...\n"; |
lprintf (_b "MLdonkey can not work with such a system date, exiting...\n"); |
431 |
CommonGlobals.exit_properly 0 |
CommonGlobals.exit_properly 0 |
432 |
end; |
end; |
433 |
|
|
437 |
ignore(Ip.from_name hostname) |
ignore(Ip.from_name hostname) |
438 |
with |
with |
439 |
e -> |
e -> |
440 |
lprintf "\nDNS resolution does not work! Looking up %s failed with %s.\n" |
lprintf (_b "\nDNS resolution does not work! Looking up %s failed with %s.") |
441 |
hostname (Printexc2.to_string e); |
hostname (Printexc2.to_string e); |
442 |
lprintf "The core therefore is unable to get eDonkey serverlists and loading\n"; |
lprintf " |
443 |
lprintf ".torrent files via dllink from websites is also impossible.\n\n"; |
The core therefore is unable to get eDonkey serverlists and loading |
444 |
lprintf "If you are using MLDonkey in a chroot environment you should\n"; |
.torrent files via dllink from websites is also impossible. |
445 |
lprintf "consider reading this article to get DNS support back:\n"; |
If you are using MLDonkey in a chroot environment you should |
446 |
lprintf "http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=Chroot\n\n" |
consider reading this article to get DNS support back: |
447 |
); |
http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=Chroot\n\n"); |
448 |
|
|
449 |
load_config (); |
load_config (); |
450 |
|
|
464 |
end; |
end; |
465 |
|
|
466 |
(* lprintf "(3) networks_iter load_complex_options\n"; *) |
(* lprintf "(3) networks_iter load_complex_options\n"; *) |
467 |
|
lprint_string (DriverControlers.text_of_html !!motd_html); |
468 |
|
lprintf (_b "\nCheck http://www.mldonkey.net/ for updates\n"); |
469 |
networks_iter (fun r -> network_load_complex_options r); |
networks_iter (fun r -> network_load_complex_options r); |
470 |
networks_iter_all (fun r -> |
lprintf (_b "enabling networks: "); |
|
lprintf (_b "Network %s %s\n") r.network_name |
|
|
(if network_is_enabled r then |
|
|
(_s "enabled") else (_s "disabled")); |
|
|
); |
|
471 |
networks_iter (fun r -> |
networks_iter (fun r -> |
472 |
(* lprintf "(4) networks_iter enabling\n"; *) |
(* lprintf "(4) networks_iter enabling\n"; *) |
473 |
network_enable r; |
network_enable r; |
474 |
|
lprintf (_b "%s ") r.network_name; |
475 |
(* are there drawbacks to start recover_temp unconditionally here ? *) |
(* are there drawbacks to start recover_temp unconditionally here ? *) |
476 |
if !!recover_temp_on_startup then |
if !!recover_temp_on_startup then |
477 |
network_recover_temp r; |
network_recover_temp r; |
478 |
); |
); |
479 |
|
lprint_newline (); |
480 |
|
lprintf (_b "disabled networks: "); |
481 |
|
let found = ref false in |
482 |
|
networks_iter_all (fun r -> |
483 |
|
if not (network_is_enabled r) then |
484 |
|
begin |
485 |
|
found := true; |
486 |
|
lprintf (_b "%s ") r.network_name |
487 |
|
end); |
488 |
|
if not !found then lprintf (_b "none"); |
489 |
|
lprint_newline (); |
490 |
CommonOptions.start_running_plugins := true; |
CommonOptions.start_running_plugins := true; |
491 |
CommonInteractive.force_download_quotas (); |
CommonInteractive.force_download_quotas (); |
492 |
|
|
514 |
Options.prune_file users_ini; |
Options.prune_file users_ini; |
515 |
(* Options.prune_file downloads_expert_ini; *) |
(* Options.prune_file downloads_expert_ini; *) |
516 |
add_timer 20. (fun _ -> try CommonWeb.load_web_infos () with _ -> ()); |
add_timer 20. (fun _ -> try CommonWeb.load_web_infos () with _ -> ()); |
|
lprintf (_b "\nWelcome to MLdonkey client\n"); |
|
|
lprintf (_b "Check http://www.mldonkey.net/ for updates\n"); |
|
517 |
lprintf (_b "To command: telnet %s %d\n") |
lprintf (_b "To command: telnet %s %d\n") |
518 |
(if !!telnet_bind_addr = Ip.any then "127.0.0.1" |
(if !!telnet_bind_addr = Ip.any then "127.0.0.1" |
519 |
else Ip.to_string !!telnet_bind_addr) !!telnet_port; |
else Ip.to_string !!telnet_bind_addr) !!telnet_port; |
524 |
lprintf (_b "Connect to IP %s, port %d\n") |
lprintf (_b "Connect to IP %s, port %d\n") |
525 |
(if !!gui_bind_addr = Ip.any then "127.0.0.1" |
(if !!gui_bind_addr = Ip.any then "127.0.0.1" |
526 |
else Ip.to_string !!gui_bind_addr) !!gui_port; |
else Ip.to_string !!gui_bind_addr) !!gui_port; |
527 |
lprintf (_b "If you connect from a remote machine adjust allowed_ips\n\n"); |
lprintf (_b "If you connect from a remote machine adjust allowed_ips\n"); |
528 |
if Autoconf.system = "windows" then lprintf (_b "%s") win_message; |
if Autoconf.system = "windows" then lprintf (_b "%s") win_message; |
|
lprint_string (DriverControlers.text_of_html !!motd_html); |
|
|
lprint_newline (); |
|
529 |
|
|
530 |
if Autoconf.system <> "windows" then |
if Autoconf.system <> "windows" then |
531 |
(* Doesn't work on windows with mingw, because getpid always returns 948 *) |
(* Doesn't work on windows with mingw, because getpid always returns 948 *) |
534 |
output_string oc ( Printf.sprintf "%s\n" ( string_of_int ( Unix.getpid () ) ) ); |
output_string oc ( Printf.sprintf "%s\n" ( string_of_int ( Unix.getpid () ) ) ); |
535 |
close_out oc; |
close_out oc; |
536 |
CommonGlobals.do_at_exit (fun _ -> Sys.remove "mlnet.pid" ); |
CommonGlobals.do_at_exit (fun _ -> Sys.remove "mlnet.pid" ); |
537 |
lprintf "Starting with pid %s\n" ( string_of_int ( Unix.getpid () ) ) |
if !verbose then lprintf (_b "Starting with pid %s\n") (string_of_int(Unix.getpid ())) |
538 |
); |
); |
539 |
|
|
540 |
add_init_hook (fun _ -> |
add_init_hook (fun _ -> |
602 |
(Sys.Signal_handle (fun _ -> lprintf "SIGTERM\n"; |
(Sys.Signal_handle (fun _ -> lprintf "SIGTERM\n"; |
603 |
CommonGlobals.exit_properly 0)); |
CommonGlobals.exit_properly 0)); |
604 |
|
|
605 |
lprintf (_b "Activated system signal handling\n\n"); |
if !verbose then lprintf (_b "Activated system signal handling\n\n"); |
606 |
|
|
607 |
Unix32.max_cache_size := MlUnix.max_filedescs |
Unix32.max_cache_size := MlUnix.max_filedescs |
608 |
|
|
610 |
lprintf (_b "Core started"); |
lprintf (_b "Core started"); |
611 |
core_included := true; |
core_included := true; |
612 |
CommonGlobals.print_localtime (); |
CommonGlobals.print_localtime (); |
|
CommonGlobals.do_at_exit (fun _ -> CommonGlobals.print_localtime ()); |
|
|
CommonGlobals.do_at_exit (fun _ -> lprintf "Core stopped"); |
|
613 |
|
|
614 |
let security_space_filename = "config_files_space.tmp" in |
let security_space_filename = "config_files_space.tmp" in |
615 |
begin |
begin |
651 |
Sys.remove security_space_filename; |
Sys.remove security_space_filename; |
652 |
DriverInteractive.save_config (); |
DriverInteractive.save_config (); |
653 |
|
|
654 |
CommonGlobals.print_localtime (); |
lprintf (_b "Core stopped"); |
655 |
lprintf (_b "Core stopped\n") |
CommonGlobals.print_localtime () |
656 |
); |
); |
657 |
|
|
658 |
if not !keep_console_output then begin |
if not !keep_console_output then begin |