mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Wed, 11 Jan 2006 19:12:35 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/01/11 19:12:35

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonInteractive.ml commonServer.ml 
                           commonUploads.ml 
        src/daemon/driver: driverMain.ml 
        src/networks/fasttrack: fasttrackGlobals.ml fasttrackServers.ml 
        src/networks/fileTP: fileTPClients.ml fileTPGlobals.ml 
                             fileTPInteractive.ml 
        src/networks/gnutella: gnutellaClients.ml gnutellaGlobals.ml 
                               gnutellaProtocol.ml 
        src/networks/gnutella2: g2Handler.ml g2Proto.ml 

Log message:
        patch #4790

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.668&tr2=1.669&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonServer.ml.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonUploads.ml.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverMain.ml.diff?tr1=1.87&tr2=1.88&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fasttrack/fasttrackGlobals.ml.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fasttrack/fasttrackServers.ml.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fileTP/fileTPClients.ml.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fileTP/fileTPGlobals.ml.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fileTP/fileTPInteractive.ml.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella/gnutellaClients.ml.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella/gnutellaGlobals.ml.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella/gnutellaProtocol.ml.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella2/g2Handler.ml.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella2/g2Proto.ml.diff?tr1=1.14&tr2=1.15&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.668 mldonkey/distrib/ChangeLog:1.669
--- mldonkey/distrib/ChangeLog:1.668    Wed Jan 11 18:53:29 2006
+++ mldonkey/distrib/ChangeLog  Wed Jan 11 19:12:34 2006
@@ -15,6 +15,7 @@
 =========
 
 2006/01/11
+4790: Some logging stuff
 4781: Disconnect connected server before removing
 4782: Configure: Replace AC_CHECK_FILE with "test -d" to allow cross-compile
 
Index: mldonkey/src/daemon/common/commonInteractive.ml
diff -u mldonkey/src/daemon/common/commonInteractive.ml:1.62 
mldonkey/src/daemon/common/commonInteractive.ml:1.63
--- mldonkey/src/daemon/common/commonInteractive.ml:1.62        Wed Jan 11 
18:53:29 2006
+++ mldonkey/src/daemon/common/commonInteractive.ml     Wed Jan 11 19:12:34 2006
@@ -40,6 +40,16 @@
 open CommonTypes
 open CommonComplexOptions
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s[cInt] "
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s[cInt] "
+    (log_time ()); lprintf
+
 (*************  ADD/REMOVE FUNCTIONS ************)
 let check_forbidden_chars (uc : Charset.uchar) =
   match uc with
@@ -133,7 +143,7 @@
            ("NETWORK",   network.network_name);
            ("ED2K_HASH", ed2k_hash)]
   with e -> 
-      lprintf_nl "[cInt] Exception %s while executing %s"
+      lprintf_nl () "Exception %s while executing %s"
         (Printexc2.to_string e) !!file_completed_cmd
   end
 
@@ -175,7 +185,7 @@
               Unix2.chmod new_name (Misc.int_of_octal_string 
!!create_dir_mask);
             let best_name = file_best_name file in
             Unix32.destroy (file_fd file);
-            if !verbose then lprintf_nl "[cInt] file_commit: destroyed";
+            if !verbose then lprintf_nl () " file_commit: destroyed";
             if Unix2.is_directory file_name then Unix2.remove_all_directory 
file_name;
             let impl = as_file_impl file in
 
@@ -190,7 +200,7 @@
                       incoming.shdir_dirname incoming.shdir_priority
                       best_name new_name);
               with e ->
-                  lprintf_nl "[cInt] Exception %s while trying to share 
commited file"
+                  lprintf_nl () "Exception %s while trying to share commited 
file"
                     (Printexc2.to_string e);
             end;
 
@@ -198,7 +208,7 @@
             done_files =:= List2.removeq file !!done_files;
             files =:= List2.removeq file !!files;
 
-            if !verbose then lprintf_nl "[cInt]file_commit: going to 
secondaries...";
+            if !verbose then lprintf_nl () "file_commit: going to 
secondaries...";
             List.iter (fun file ->
 (* Commit the file first, and share it after... *)
                 try
@@ -209,10 +219,10 @@
                   files =:= List2.removeq file !!files;
 
                 with e ->
-                    lprintf_nl "[cInt] Exception %s in file_commit 
secondaries" (Printexc2.to_string e);
+                    lprintf_nl () "Exception %s in file_commit secondaries" 
(Printexc2.to_string e);
             ) secondary_files
           with e ->
-              lprintf_nl "[cInt] Exception in file_commit: %s" 
(Printexc2.to_string e))
+              lprintf_nl () "Exception in file_commit: %s" 
(Printexc2.to_string e))
     | _ -> assert false
 
 let file_cancel file =
@@ -228,20 +238,20 @@
             impl.impl_file_ops.op_file_cancel impl.impl_file_val;
             files =:= List2.removeq file !!files;
           with e ->
-              lprintf_nl "[cInt] Exception %s in file_cancel" 
(Printexc2.to_string e);
+              lprintf_nl () "Exception %s in file_cancel" (Printexc2.to_string 
e);
       ) subfiles;
       try
        let fd = file_fd file in
        (try
            Unix32.remove fd
          with e ->
-           lprintf_nl "[cInt]Sys.remove %s exception %s"
+           lprintf_nl () "Sys.remove %s exception %s"
              (file_disk_name file)
              (Printexc2.to_string e));
        Unix32.destroy fd
       with Not_found -> ()
   with e ->
-      lprintf_nl "[cInt] Exception in file_cancel: %s" (Printexc2.to_string e)
+      lprintf_nl () "Exception in file_cancel: %s" (Printexc2.to_string e)
 
 let mail_for_completed_file file =
   if !!mail <> "" then
@@ -303,14 +313,14 @@
         ignore (CommonShared.new_shared "completed" 0 (
             file_best_name file ) file_name);
         (try mail_for_completed_file file with e ->
-              lprintf_nl "[cInt] Exception %s in sendmail" 
(Printexc2.to_string e);
+              lprintf_nl () "Exception %s in sendmail" (Printexc2.to_string e);
               );
         if !!CommonOptions.chat_warning_for_downloaded then
           chat_for_completed_file file;
 
       end
   with e ->
-      lprintf_nl "[cInt] Exception in file_completed: %s" (Printexc2.to_string 
e)
+      lprintf_nl () "Exception in file_completed: %s" (Printexc2.to_string e)
 
 let file_add impl state =
   try
@@ -332,7 +342,7 @@
         update_file_state impl state
       end
   with e ->
-      lprintf_nl "[cInt] Exception in file_add: %s" (Printexc2.to_string e)
+      lprintf_nl () "[cInt] Exception in file_add: %s" (Printexc2.to_string e)
 
 let server_remove server =
   begin
@@ -349,7 +359,7 @@
         servers =:= Intmap.remove (server_num server) !!servers
       end
   with e ->
-      lprintf_nl "[cInt] Exception in server_remove: %s" (Printexc2.to_string 
e)
+      lprintf_nl () "[cInt] Exception in server_remove: %s" 
(Printexc2.to_string e)
 
 let server_add impl =
   let server = as_server impl in
@@ -388,7 +398,7 @@
       end
 
   with e ->
-      lprintf_nl "[cInt] Exception in friend_remove: %s" (Printexc2.to_string 
e)
+      lprintf_nl () "Exception in friend_remove: %s" (Printexc2.to_string e)
 
 let contact_add c =
   let impl = as_client_impl c in
@@ -409,7 +419,7 @@
         impl.impl_client_ops.op_client_clear_files impl.impl_client_val
       end
   with e ->
-      lprintf_nl "[cInt] Exception in contact_remove: %s" (Printexc2.to_string 
e)
+      lprintf_nl () "Exception in contact_remove: %s" (Printexc2.to_string e)
 
 let exit_counter = ref 0
 let exit_timer = ref false
@@ -752,7 +762,7 @@
        !names
 
 let apply_on_fully_qualified_options name f =
-  if !verbose then lprintf_nl "[cInt] Change option %s" name;
+  if !verbose then lprintf_nl () "Change option %s" name;
   let rec iter prefix opfile =
     let args = simple_options prefix opfile in
     List.iter (fun o ->
@@ -775,7 +785,7 @@
               false
             with Exit -> true
         )) then begin
-        lprintf_nl "[cInt] Could not set option %s" name;
+        lprintf_nl () "Could not set option %s" name;
         raise Not_found
       end
   with Exit -> ()
@@ -833,7 +843,7 @@
           | _ -> ()
         end
     | QNone ->
-        lprintf_nl "[cInt]start_search: QNone in query";
+        lprintf_nl () "start_search: QNone in query";
         ()
   in
   iter query;
Index: mldonkey/src/daemon/common/commonServer.ml
diff -u mldonkey/src/daemon/common/commonServer.ml:1.22 
mldonkey/src/daemon/common/commonServer.ml:1.23
--- mldonkey/src/daemon/common/commonServer.ml:1.22     Wed Jan 11 18:53:30 2006
+++ mldonkey/src/daemon/common/commonServer.ml  Wed Jan 11 19:12:35 2006
@@ -25,6 +25,16 @@
 open CommonUser
 open CommonTypes
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s[cSe] "
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s[cSe] "
+    (log_time ()); lprintf
+
 module G = GuiTypes
 
 type 'a server_impl = {
@@ -56,7 +66,7 @@
 let ni n m =
   let s = Printf.sprintf "Server.%s not implemented by %s"
       m n.network_name in
-  lprintf_nl "%s" s;
+  lprintf_nl () "%s" s;
   s
 
 let fni n m =  failwith (ni n m)
@@ -190,36 +200,36 @@
   s
 
 let check_server_implementations () =
-  lprintf_nl "\n----- Methods not implemented for CommonServer ----\n";
+  lprintf_nl () "----- Methods not implemented for CommonServer ----";
   List.iter (fun (c, cc) ->
       let n = c.op_server_network.network_name in
-      lprintf_nl "\n  Network %s\n" n;
+      lprintf_nl ()"  Network %s" n;
       if c.op_server_remove == cc.op_server_remove then
-        lprintf_nl "op_server_remove";
+        lprintf_nl () "op_server_remove";
       if c.op_server_to_option == cc.op_server_to_option then
-        lprintf_nl "op_server_to_option";
+        lprintf_nl () "op_server_to_option";
       if c.op_server_info == cc.op_server_info then
-        lprintf_nl "op_server_info";
+        lprintf_nl () "op_server_info";
       if c.op_server_sort == cc.op_server_sort then
-        lprintf_nl "op_server_sort";
+        lprintf_nl () "op_server_sort";
       if c.op_server_connect == cc.op_server_connect then
-        lprintf_nl "op_server_connect";
+        lprintf_nl () "op_server_connect";
       if c.op_server_disconnect == cc.op_server_disconnect then
-        lprintf_nl "op_server_disconnect";
+        lprintf_nl () "op_server_disconnect";
       if c.op_server_find_user == cc.op_server_find_user then
-        lprintf_nl "op_server_find_user";
+        lprintf_nl () "op_server_find_user";
       if c.op_server_query_users == cc.op_server_query_users then
-        lprintf_nl "op_server_query_users";
+        lprintf_nl () "op_server_query_users";
       if c.op_server_users == cc.op_server_users then
-        lprintf_nl "op_server_users";
+        lprintf_nl () "op_server_users";
       if c.op_server_cid == cc.op_server_cid then
-        lprintf_nl "op_server_cid";
+        lprintf_nl () "op_server_cid";
       if c.op_server_low_id == cc.op_server_low_id then
-        lprintf_nl "op_server_low_id";
+        lprintf_nl () "op_server_low_id";
       if c.op_server_rename == cc.op_server_rename then
-        lprintf_nl "op_server_rename";
+        lprintf_nl () "op_server_rename";
       if c.op_server_set_preferred == cc.op_server_set_preferred then
-        lprintf_nl "op_server_set_preferred";
+        lprintf_nl () "op_server_set_preferred";
   ) !servers_ops;
   lprint_newline ()
 
@@ -311,7 +321,7 @@
   try
     let info =
       try server_info s with e ->
-          lprintf "Exception %s in server_info (%s)\n"
+          lprintf_nl () "Exception %s in server_info (%s)\n"
             (Printexc2.to_string e) n.network_name;
           raise e in
 
@@ -449,5 +459,5 @@
       end;
 
   with e ->
-      lprintf "Exception %s in CommonServer.server_print\n"
+      lprintf_nl () "Exception %s in CommonServer.server_print"
         (Printexc2.to_string e)
Index: mldonkey/src/daemon/common/commonUploads.ml
diff -u mldonkey/src/daemon/common/commonUploads.ml:1.39 
mldonkey/src/daemon/common/commonUploads.ml:1.40
--- mldonkey/src/daemon/common/commonUploads.ml:1.39    Mon Jan  9 00:25:58 2006
+++ mldonkey/src/daemon/common/commonUploads.ml Wed Jan 11 19:12:35 2006
@@ -33,6 +33,16 @@
 open CommonGlobals
 open CommonOptions
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s[cUp] "
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s[cUp] "
+    (log_time ()); lprintf
+
 (*
 PROBLEMS: most of the time, users won't share their files on all networks.
 We should provide a different directory than incoming/, where files
@@ -439,7 +449,7 @@
             CommonHasher.compute_sha1 (Unix32.filename sh.shared_fd)
             zero info.shared_size (fun job ->
                 if job.CommonHasher.job_error then begin
-                    lprintf_nl "[cUp] Error during hashing of %s" 
info.shared_fullname;
+                    lprintf_nl () "Error during hashing of %s" 
info.shared_fullname;
                     current_job := None;
                   end else
                   begin
@@ -527,7 +537,7 @@
                 pos (min (size -- pos) chunk_size)
               (fun job ->
                   if job.CommonHasher.job_error then begin
-                      lprintf_nl "[cUp] Error during hashing of %s" 
info.shared_fullname;
+                      lprintf_nl () "Error during hashing of %s" 
info.shared_fullname;
                       current_job := None;
                     end else begin
 
@@ -561,7 +571,7 @@
                   pos (min (size -- pos) chunk_size)
               (fun job ->
                     if job.CommonHasher.job_error then begin
-                      lprintf_nl "[cUp] Error during hashing of %s"
+                      lprintf_nl () "Error during hashing of %s"
                       info.shared_fullname;
                         current_job := None;
                       end else begin
@@ -598,7 +608,7 @@
             [] ->  waiting_shared_files := tail;
           | uid :: tail ->
               if !verbose_share then
-                lprintf_nl "[cUp] shared_files_timer: starting job";
+                lprintf_nl () "shared_files_timer: starting job";
               sh.shared_uids_wanted <- tail;
               current_job := Some sh;
               start_job_for sh uid
@@ -818,7 +828,7 @@
 
 let add_pending_slot c =
   if client_has_a_slot c then begin
-      if !verbose_upload then lprintf_nl "[cUp] Avoided inserting an uploader 
in pending slots!"
+      if !verbose_upload then lprintf_nl () "Avoided inserting an uploader in 
pending slots!"
     end
   else
   if not (Intmap.mem (client_num c) !pending_slots_map) then
@@ -901,7 +911,7 @@
   let open_slots n =
     let i = ref n in
     if !verbose_upload then
-      lprintf_nl "[cUp] try to allocate %d more slots" n;
+      lprintf_nl () "try to allocate %d more slots" n;
     while !i > 0 do
       find_pending_slot ();
       decr i
@@ -916,7 +926,7 @@
     (* max_hard_upload_rate lowered manually,... *)
     mini estimated_capacity (!!max_hard_upload_rate * 1024) in
   if !verbose_upload then
-    lprintf_nl "[cUp] usage: %d(%d) capacity: %d"
+    lprintf_nl () "usage: %d(%d) capacity: %d"
       (short_delay_upload_usage ())
       (upload_usage ())
       estimated_capacity;
@@ -926,13 +936,13 @@
 (* enough free bw for another slot *)
     if short_delay_upload_usage () + slot_bw < estimated_capacity then begin
       if !verbose_upload then
-       lprintf_nl "[cUp] uplink not fully used";
+       lprintf_nl () "uplink not fully used";
       incr not_saturated_count
     end else reset_state ();
 
     if len < min_upload_slots then begin
       if !verbose_upload then
-       lprintf_nl "[cUp] too few upload slots";
+       lprintf_nl () "too few upload slots";
       open_slots (min_upload_slots - len);
       reset_state ()
     end else if !not_saturated_count >= 2 then begin
@@ -1012,10 +1022,10 @@
 let upload_download_timer () =
   (try download_engine ()
     with e ->
-        lprintf_nl "[cUp] Exception %s in download_engine" 
(Printexc2.to_string e)
+        lprintf_nl () "Exception %s in download_engine" (Printexc2.to_string e)
   );
   (try next_uploads ()
-  with e -> lprintf_nl "[cUp] exc %s in upload" (Printexc2.to_string e))
+  with e -> lprintf_nl () "exc %s in upload" (Printexc2.to_string e))
 
 let words_of_filename =
   let extension_list = [
@@ -1038,7 +1048,7 @@
   let get_name_keywords file_name =
     match remove_short (String2.stem file_name) [] with
       [] | [_] ->
-        lprintf_nl "[cUp] Not enough keywords to recover %s" file_name;
+        lprintf_nl () "Not enough keywords to recover %s" file_name;
         [file_name]
     | l -> l
   in
Index: mldonkey/src/daemon/driver/driverMain.ml
diff -u mldonkey/src/daemon/driver/driverMain.ml:1.87 
mldonkey/src/daemon/driver/driverMain.ml:1.88
--- mldonkey/src/daemon/driver/driverMain.ml:1.87       Fri Jan  6 22:23:09 2006
+++ mldonkey/src/daemon/driver/driverMain.ml    Wed Jan 11 19:12:35 2006
@@ -50,6 +50,16 @@
 let _s x = _s "DriverMain" x
 let _b x = _b "DriverMain" x
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s"
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s"
+    (log_time ()); lprintf
+
 let keep_console_output = ref false
 let pid = ref ""
 
@@ -87,11 +97,11 @@
   (try
       update_link_stats ()
     with e ->
-        lprintf_nl (_b "Exception %s") (Printexc2.to_string e));
+        lprintf_nl () (_b "Exception %s") (Printexc2.to_string e));
          (try
      CommonUploads.refill_upload_slots ()
    with e ->
-        lprintf_nl (_b "Exception %s") (Printexc2.to_string e));
+        lprintf_nl () (_b "Exception %s") (Printexc2.to_string e));
   CommonUploads.reset_upload_timer ();
   CommonUploads.shared_files_timer ();
   ()
@@ -102,7 +112,7 @@
   if !!http_port <> 0 then begin try
         ignore (DriverControlers.create_http_handler ());
       with e ->
-          lprintf_nl (_b "Exception %s while starting HTTP interface")
+          lprintf_nl () (_b "Exception %s while starting HTTP interface")
             (Printexc2.to_string e);
     end;
 
@@ -131,7 +141,7 @@
 
 let _ =
   CommonWeb.add_web_kind "motd.html" (fun _ filename ->
-      lprintf_nl (_b "motd.html changed");
+      lprintf_nl () (_b "motd.html changed");
     motd_html =:= File.to_string filename
   );
   CommonWeb.add_web_kind "motd.conf" (fun _ filename ->
@@ -149,13 +159,13 @@
        | "del_item" ->
             CommonInteractive.del_item_from_fully_qualified_options name value
        | _ ->
-           lprintf_nl (_b "UNUSED LINE: %s") line
+           lprintf_nl () (_b "UNUSED LINE: %s") line
 
       done;
     with
     | End_of_file ->
        close_in ic
-    | e -> lprintf_nl (_b "Error while reading motd.conf(%s): %s") filename
+    | e -> lprintf_nl () (_b "Error while reading motd.conf(%s): %s") filename
        (Printexc2.to_string e);
        close_in ic
   );
@@ -253,7 +263,7 @@
   in
   if not exists_users_ini && exists_downloads_ini then
     begin
-      lprintf_nl "No config file (users.ini) found. Importing users from 
downloads.ini.";
+      lprintf_nl () "No config file (users.ini) found. Importing users from 
downloads.ini.";
       ( try Unix2.copy "downloads.ini" "users.ini" with _ -> () );
     end;
 
@@ -263,7 +273,7 @@
       Options.load downloads_ini;
       Options.load users_ini;
     with e ->
-        lprintf_nl "Exception %s during options load" (Printexc2.to_string e);
+        lprintf_nl () "Exception %s during options load" (Printexc2.to_string 
e);
         exit 70);
 
   (* Here, we try to update options when a new version of mldonkey is
@@ -311,14 +321,14 @@
 
   Arg.parse ([
       "-v", Arg.Unit (fun _ ->
-          lprintf_nl "%s" (CommonGlobals.version ());
+          lprintf_nl () "%s" (CommonGlobals.version ());
           exit 0), _s " : print version number and exit";
       "-exit", Arg.Unit (fun _ -> exit 0), ": exit immediatly";
       "-format", Arg.String (fun file ->
           ignore (CommonMultimedia.get_info file)),
           _s  " <filename> : check file format";
       "-test_ip", Arg.String (fun ip ->
-          lprintf_nl "%s = %s" ip (Ip.to_string (Ip.of_string ip));
+          lprintf_nl () "%s = %s" ip (Ip.to_string (Ip.of_string ip));
           exit 0), _s "<ip> : undocumented";
       "-check_impl", Arg.Unit (fun _ ->
           CommonNetwork.check_network_implementations ();
@@ -341,7 +351,7 @@
        _s ": keep output to stderr after startup";
       "-daemon", Arg.Unit (fun _ ->
           (* Removed due to savannah bug #11514 . *)
-          lprintf_nl "\n\nOption -daemon was removed.\nUse 'mlnet > /dev/null 
2>&1 &' instead. Exiting...";
+          lprintf_nl () "\n\nOption -daemon was removed.\nUse 'mlnet > 
/dev/null 2>&1 &' instead. Exiting...";
           exit 64), _s " : this argument was removed, core will exit";
       "-find_port", Arg.Set find_other_port,
       _s " : find another port when one is already used";
@@ -376,8 +386,8 @@
   let t = Unix.localtime (Unix.time ()) in
   if (t.Unix.tm_year<=104) then
     begin
-      lprintf_nl (_b "\n\n\nYour system has a system date earlier than 2004, 
please correct it.");
-      lprintf_nl (_b "MLdonkey can not work with such a system date, 
exiting...");
+      lprintf_nl () (_b "\n\n\nYour system has a system date earlier than 
2004, please correct it.");
+      lprintf_nl () (_b "MLdonkey can not work with such a system date, 
exiting...");
       CommonGlobals.exit_properly 71
     end;
 
@@ -424,7 +434,7 @@
   end;
 
 (*  lprintf "(3) networks_iter load_complex_options\n"; *)
-  lprintf_nl (_b "Check http://www.mldonkey.net/ for updates");
+  lprintf_nl () (_b "Check http://www.mldonkey.net/ for updates");
   networks_iter (fun r -> network_load_complex_options r);
   lprintf (_b "%senabling networks: ") (log_time ());
   networks_iter (fun r ->
@@ -471,17 +481,17 @@
   Options.prune_file users_ini;
 (*  Options.prune_file downloads_expert_ini; *)
   add_timer 10. (fun _ -> try CommonWeb.load_web_infos true with _ -> ());
-  lprintf_nl (_b "To command: telnet %s %d")
+  lprintf_nl ()  (_b "To command: telnet %s %d")
        (if !!telnet_bind_addr = Ip.any then "127.0.0.1"
                else Ip.to_string !!telnet_bind_addr)  !!telnet_port;
-  lprintf_nl (_b "Or with browser: http://%s:%d";)
+  lprintf_nl ()  (_b "Or with browser: http://%s:%d";)
        (if !!http_bind_addr = Ip.any then "127.0.0.1"
                else Ip.to_string !!http_bind_addr)  !!http_port;
-  lprintf_nl (_b "For a GUI check out http://sancho-gui.sourceforge.net";);
-  lprintf_nl (_b "Connect to IP %s, port %d")
+  lprintf_nl ()  (_b "For a GUI check out http://sancho-gui.sourceforge.net";);
+  lprintf_nl ()  (_b "Connect to IP %s, port %d")
        (if !!gui_bind_addr = Ip.any then "127.0.0.1"
                else Ip.to_string !!gui_bind_addr)  !!gui_port;
-  lprintf_nl (_b "If you connect from a remote machine adjust allowed_ips");
+  lprintf_nl ()  (_b "If you connect from a remote machine adjust 
allowed_ips");
   if Autoconf.system = "cygwin" && not !keep_console_output then lprintf (_b 
"%s") win_message;
 
   add_init_hook (fun _ ->
@@ -496,7 +506,7 @@
             Sys.file_exists asker then
             ignore (Sys.command (Printf.sprintf "%s %s&" asker 
!!mldonkey_gui));
         with Not_found ->
-            lprintf_nl (_b "Not running under X, not trying to start the GUI")
+            lprintf_nl () (_b "Not running under X, not trying to start the 
GUI")
             );
   );
 
@@ -505,9 +515,9 @@
         let new_pw = Unix.getpwnam !!run_as_user in
         MlUnix.setuid new_pw.Unix.pw_uid;
         let pw = Unix.getpwuid (Unix.getuid()) in
-        lprintf_nl (_b "mldonkey is now running as user %s") pw.Unix.pw_name;
+        lprintf_nl () (_b "mldonkey is now running as user %s") 
pw.Unix.pw_name;
       with e ->
-          lprintf_nl (_b "Exception %s trying to set user_uid [%s]")
+          lprintf_nl () (_b "Exception %s trying to set user_uid [%s]")
           (Printexc2.to_string e) !!run_as_user;
           exit 67
     end;
@@ -515,9 +525,9 @@
   if !!run_as_useruid <> 0 then begin
       try
         MlUnix.setuid !!run_as_useruid;
-        lprintf_nl (_b "mldonkey is now running as uid %d")  !!run_as_useruid;
+        lprintf_nl () (_b "mldonkey is now running as uid %d")  
!!run_as_useruid;
       with e ->
-          lprintf_nl (_b "Exception %s trying to set user_uid [%d]")
+          lprintf_nl () (_b "Exception %s trying to set user_uid [%d]")
           (Printexc2.to_string e) !!run_as_useruid;
           exit 67
     end;
@@ -528,29 +538,29 @@
 
   if not Autoconf.windows then
     MlUnix.set_signal  Sys.sigchld
-      (Sys.Signal_handle (fun _ -> if !verbose then lprintf_nl "Received 
SIGCHLD, doing nothing"));
+      (Sys.Signal_handle (fun _ -> if !verbose then lprintf_nl () "Received 
SIGCHLD, doing nothing"));
 
   if not Autoconf.windows then
     MlUnix.set_signal  Sys.sighup
       (Sys.Signal_handle (fun _ ->
-        lprintf_nl "Received SIGHUP, closing all files/sockets";
+        lprintf_nl () "Received SIGHUP, closing all files/sockets";
          BasicSocket.close_all ();
         Unix32.close_all ()
          ));
 
   if not Autoconf.windows then
     MlUnix.set_signal  Sys.sigpipe
-      (Sys.Signal_handle (fun _ -> if !verbose then lprintf_nl "Received 
SIGPIPE, doing nothing"));
+      (Sys.Signal_handle (fun _ -> if !verbose then lprintf_nl () "Received 
SIGPIPE, doing nothing"));
 
   MlUnix.set_signal  Sys.sigint
-    (Sys.Signal_handle (fun _ -> lprintf_nl "Received SIGINT, stopping 
MLDonkey...";
+    (Sys.Signal_handle (fun _ -> lprintf_nl () "Received SIGINT, stopping 
MLDonkey...";
         CommonInteractive.clean_exit 0));
 
   MlUnix.set_signal  Sys.sigterm
-    (Sys.Signal_handle (fun _ -> lprintf_nl "Received SIGTERM, stopping 
MLDonkey...";
+    (Sys.Signal_handle (fun _ -> lprintf_nl () "Received SIGTERM, stopping 
MLDonkey...";
         CommonInteractive.clean_exit 0));
 
-  if !verbose then lprintf_nl (_b "Activated system signal handling")
+  if !verbose then lprintf_nl () (_b "Activated system signal handling")
 
 let _ =
   let security_space_filename = "config_files_space.tmp" in
@@ -573,9 +583,9 @@
       in
       Unix32.close security_space_fd;
     with _ ->
-        lprintf_nl (_b "Cannot create Security space file:");
-        lprintf_nl (_b " not enough space on device or bad permissions");
-        lprintf_nl (_b "Exiting...");
+        lprintf_nl () (_b "Cannot create Security space file:");
+        lprintf_nl () (_b " not enough space on device or bad permissions");
+        lprintf_nl () (_b "Exiting...");
         exit 73;
   end;
   Unix32.external_start (CommonGlobals.version());
@@ -593,7 +603,7 @@
     close_out oc;
     CommonGlobals.do_at_exit (fun _ -> try Sys.remove pid_file with _ -> ());
     if !verbose then
-      lprintf_nl (_b "Starting with pid %s") (string_of_int(Unix.getpid ()))
+      lprintf_nl () (_b "Starting with pid %s") (string_of_int(Unix.getpid ()))
   );
 
 (* When a core is spawned from a gui, the only way to know the startup has
@@ -606,7 +616,7 @@
       with _ -> ()
     end;
 
-  lprintf_nl (_b "Core started");
+  lprintf_nl () (_b "Core started");
   core_included := true;
 
   CommonGlobals.do_at_exit (fun _ ->
@@ -615,7 +625,7 @@
       (try
          BasicSocket.close_all ();
        with e ->
-           lprintf_nl "Exception %s in do_at_exit while closing sockets."
+           lprintf_nl () "Exception %s in do_at_exit while closing sockets."
              (Printexc2.to_string e);
       );
       CommonGraphics.remove_files ();
@@ -627,14 +637,14 @@
       CommonComplexOptions.backup_options ();
       Geoip.close ();
       Unix32.external_exit ();
-      lprintf_nl (_b "Core stopped")
+      lprintf_nl () (_b "Core stopped")
     );
 
   if not !keep_console_output then
     if !!log_file = "" then 
       begin
-        lprintf_nl (_b "Option log_file is empty, disable logging 
completely...");
-        lprintf_nl (_b "Disabling output to console, to enable: stdout true");
+        lprintf_nl () (_b "Option log_file is empty, disable logging 
completely...");
+        lprintf_nl () (_b "Disabling output to console, to enable: stdout 
true");
        log_to_file stdout;
         close_log ()
       end
Index: mldonkey/src/networks/fasttrack/fasttrackGlobals.ml
diff -u mldonkey/src/networks/fasttrack/fasttrackGlobals.ml:1.30 
mldonkey/src/networks/fasttrack/fasttrackGlobals.ml:1.31
--- mldonkey/src/networks/fasttrack/fasttrackGlobals.ml:1.30    Mon Jan  9 
00:25:59 2006
+++ mldonkey/src/networks/fasttrack/fasttrackGlobals.ml Wed Jan 11 19:12:35 2006
@@ -44,6 +44,16 @@
 open FasttrackTypes
 open FasttrackOptions
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s[Fasttrack] "
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s[Fasttrack] "
+    (log_time ()); lprintf
+
 let search_num = ref 0
 
 let should_update_shared_files = ref false
Index: mldonkey/src/networks/fasttrack/fasttrackServers.ml
diff -u mldonkey/src/networks/fasttrack/fasttrackServers.ml:1.26 
mldonkey/src/networks/fasttrack/fasttrackServers.ml:1.27
--- mldonkey/src/networks/fasttrack/fasttrackServers.ml:1.26    Mon Jan  9 
00:22:35 2006
+++ mldonkey/src/networks/fasttrack/fasttrackServers.ml Wed Jan 11 19:12:35 2006
@@ -385,7 +385,7 @@
 let ft_boot () =
   let imesh_ip = Ip.addr_of_string "fm2.imesh.com" in
   let (h : host) =
-    if !verbose then lprintf_nl "FT: Bootstrapping from Imesh %s" 
(Ip.string_of_addr imesh_ip);
+    if !verbose then lprintf_nl () "Bootstrapping from Imesh %s" 
(Ip.string_of_addr imesh_ip);
     H.new_host imesh_ip 1214 IndexServer
   in
   connect_server h
@@ -400,7 +400,7 @@
         if !!bootstrap_from_imesh then
          let imesh_ip = Ip.addr_of_string "fm2.imesh.com" in
           let (_ : host) =
-           if !verbose then lprintf_nl "FT: Bootstrapping from Imesh %s" 
(Ip.string_of_addr imesh_ip);
+           if !verbose then lprintf_nl () "Bootstrapping from Imesh %s" 
(Ip.string_of_addr imesh_ip);
             H.new_host (Ip.addr_of_string "fm2.imesh.com") 1214 IndexServer in
           find_ultrapeer peers_waiting_queue
         else raise Not_found
Index: mldonkey/src/networks/fileTP/fileTPClients.ml
diff -u mldonkey/src/networks/fileTP/fileTPClients.ml:1.15 
mldonkey/src/networks/fileTP/fileTPClients.ml:1.16
--- mldonkey/src/networks/fileTP/fileTPClients.ml:1.15  Wed Dec 14 21:17:47 2005
+++ mldonkey/src/networks/fileTP/fileTPClients.ml       Wed Jan 11 19:12:35 2006
@@ -63,7 +63,7 @@
   | Connection sock ->
       (try
           if !verbose_msg_clients then
-              lprintf_nl "Disconnected from source";
+              lprintf_nl () "Disconnected from source";
           c.client_requests <- [];
           connection_failed c.client_connection_control;
           set_client_disconnected c r;
Index: mldonkey/src/networks/fileTP/fileTPGlobals.ml
diff -u mldonkey/src/networks/fileTP/fileTPGlobals.ml:1.18 
mldonkey/src/networks/fileTP/fileTPGlobals.ml:1.19
--- mldonkey/src/networks/fileTP/fileTPGlobals.ml:1.18  Mon Jan  9 00:25:59 2006
+++ mldonkey/src/networks/fileTP/fileTPGlobals.ml       Wed Jan 11 19:12:35 2006
@@ -41,6 +41,16 @@
 open FileTPTypes
 open FileTPOptions
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s[FileTP] "
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s[FileTP] "
+    (log_time ()); lprintf
+
 let network = new_network "FTP" "FileTP"
     [ ]
 
Index: mldonkey/src/networks/fileTP/fileTPInteractive.ml
diff -u mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.26 
mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.27
--- mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.26      Fri Jan  6 
22:23:09 2006
+++ mldonkey/src/networks/fileTP/fileTPInteractive.ml   Wed Jan 11 19:12:35 2006
@@ -314,7 +314,7 @@
   let file = new_file (Md4.random ()) u.Url.full_file zero in
   
   if !verbose then
-    lprintf_nl "[FILETP]: DOWNLOAD FILE %s" (file_best_name  file); 
+    lprintf_nl () "DOWNLOAD FILE %s" (file_best_name  file); 
   if not (List.memq file !current_files) then begin
       current_files := file :: !current_files;
     end;
@@ -421,7 +421,7 @@
           | _ -> raise Not_found);
 
           if !verbose then
-            lprintf_nl "[FILETP]: MIRROR [%s] [%s]" !num !url;
+            lprintf_nl () "MIRROR [%s] [%s]" !num !url;
           let u = Url.of_string !url in
           let r = Url.of_string !referer in
 
@@ -432,10 +432,10 @@
           let num = int_of_string !num in
           Hashtbl.iter (fun _ file ->
               if !verbose then
-                lprintf_nl "[FILETP]: COMPARE %d/%d" (file_num file) num;
+                lprintf_nl () "COMPARE %d/%d" (file_num file) num;
               if file_num file = num then begin
                   if !verbose then
-                    lprintf_nl "[FILETP]: Try HEAD from mirror";
+                    lprintf_nl () "Try HEAD from mirror";
 
 
                   download_file_from_mirror file u r;
@@ -462,7 +462,7 @@
             _s ""
         | Not_found ->
             if !verbose then
-              lprintf_nl "[FILETP]: Not enough parameters";
+              lprintf_nl () "Not enough parameters";
             let buf = o.conn_buf in
             if o.conn_output = HTML then
               html_mods_table_one_row buf "serversTable" "servers" [
Index: mldonkey/src/networks/gnutella/gnutellaClients.ml
diff -u mldonkey/src/networks/gnutella/gnutellaClients.ml:1.36 
mldonkey/src/networks/gnutella/gnutellaClients.ml:1.37
--- mldonkey/src/networks/gnutella/gnutellaClients.ml:1.36      Mon Jan  9 
00:22:35 2006
+++ mldonkey/src/networks/gnutella/gnutellaClients.ml   Wed Jan 11 19:12:35 2006
@@ -554,7 +554,7 @@
                 iter ()
               with Not_found -> 
                if !verbose_unknown_messages then
-                  lprintf_nl "Unable to get a block !!";
+                  lprintf_nl () "Unable to get a block !!";
                   check_finished swarmer file;
                   raise Not_found
             in
@@ -582,12 +582,12 @@
 
 and disconnect_client c r =
   if !verbose then
-    lprintf_nl "DISCONNECT CLIENT";
+    lprintf_nl () "DISCONNECT CLIENT";
   match c.client_sock with
   | Connection sock -> 
       (try
           if !verbose_msg_clients then
-              lprintf_nl "Disconnected from source for %s\n" (string_of_reason 
r); 
+              lprintf_nl () "Disconnected from source for %s" 
(string_of_reason r); 
           c.client_requests <- [];
           connection_failed c.client_connection_control;
           set_client_disconnected c r;
Index: mldonkey/src/networks/gnutella/gnutellaGlobals.ml
diff -u mldonkey/src/networks/gnutella/gnutellaGlobals.ml:1.34 
mldonkey/src/networks/gnutella/gnutellaGlobals.ml:1.35
--- mldonkey/src/networks/gnutella/gnutellaGlobals.ml:1.34      Mon Jan  9 
00:25:59 2006
+++ mldonkey/src/networks/gnutella/gnutellaGlobals.ml   Wed Jan 11 19:12:35 2006
@@ -44,6 +44,16 @@
 open GnutellaOptions
 open GnutellaNetwork
 
+(* prints a new logline with date, module and starts newline *)
+let lprintf_nl () =
+  lprintf "%s[Gnutella] "
+    (log_time ()); lprintf_nl2
+
+(* prints a new logline with date, module and does not start newline *)
+let lprintf_n () =
+  lprintf "%s[Gnutella] "
+    (log_time ()); lprintf
+
 let should_update_shared_files = ref false
 
   
Index: mldonkey/src/networks/gnutella/gnutellaProtocol.ml
diff -u mldonkey/src/networks/gnutella/gnutellaProtocol.ml:1.18 
mldonkey/src/networks/gnutella/gnutellaProtocol.ml:1.19
--- mldonkey/src/networks/gnutella/gnutellaProtocol.ml:1.18     Mon Jan  9 
00:25:59 2006
+++ mldonkey/src/networks/gnutella/gnutellaProtocol.ml  Wed Jan 11 19:12:35 2006
@@ -242,7 +242,7 @@
 
 let update_shared_words () = 
   if !verbose_share then
-    lprintf_nl "update_shared_words";
+    lprintf_nl () "update_shared_words";
   all_shared_words := [];
   cached_qrt_table := "";
   let module M = CommonUploads in
@@ -257,7 +257,7 @@
     List.iter (fun sh ->
         let info = IndexedSharedFiles.get_result sh.shared_info in
         if !verbose_share then
-          lprintf_nl "CODED name: %s" sh.M.shared_codedname;
+          lprintf_nl () "CODED name: %s" sh.M.shared_codedname;
         register_words sh.M.shared_codedname;
         List.iter (fun uid ->
             words := WordSet.add (Uid.to_string uid) !words
@@ -315,12 +315,12 @@
           List.assoc "x-gnutella-alternate-location" headers in
         let locations = String2.split locations ',' in
         
-        lprintf_nl "Alternate locations";
+        lprintf_nl () "Alternate locations";
         let urls = List.map (fun s ->
               match String2.split_simplify s ' ' with
-                [] -> lprintf_nl "Cannot parse : %s" s; ""
+                [] -> lprintf_nl () "Cannot parse : %s" s; ""
               | url :: _ ->
-                  lprintf_nl "  Location: %s" url; url
+                  lprintf_nl () "  Location: %s" url; url
           ) locations in
         lprint_newline ();
         
@@ -523,7 +523,7 @@
       match url.Url.args with
         [(urn,_)] ->
           if !verbose_msg_clients then
-            lprintf_nl "Found /uri-res/N2R request";
+            lprintf_nl () "Found /uri-res/N2R request";
           find_by_uid (Uid.of_string urn)
       
       | _ -> failwith "Cannot parse /uri-res/N2R request"
@@ -534,7 +534,7 @@
     let num = String.sub file 5 (pos - 5) in
     let filename = String.sub file (pos+1) (String.length file - pos - 1) in
     if !verbose_msg_clients then
-      lprintf_nl "Download of file %s, filename = %s" num filename;
+      lprintf_nl () "Download of file %s, filename = %s" num filename;
     let num = int_of_string num in
     Hashtbl.find shareds_by_id  num
   in
Index: mldonkey/src/networks/gnutella2/g2Handler.ml
diff -u mldonkey/src/networks/gnutella2/g2Handler.ml:1.16 
mldonkey/src/networks/gnutella2/g2Handler.ml:1.17
--- mldonkey/src/networks/gnutella2/g2Handler.ml:1.16   Mon Jan  9 00:22:35 2006
+++ mldonkey/src/networks/gnutella2/g2Handler.ml        Wed Jan 11 19:12:35 2006
@@ -429,7 +429,7 @@
                   xml_info := Some xml
                 with e ->
                     if !verbose_unknown_messages then
-                      lprintf_nl "Exception %s while parsing: \n%s"
+                      lprintf_nl () "Exception %s while parsing: \n%s"
                         (Printexc2.to_string e) xml
               
               end
@@ -451,7 +451,7 @@
                 ) user_files files
               end else begin
                 if !verbose_unknown_messages then
-                  lprintf_nl "ERROR: Not enough XML entries %d/%d"
+                  lprintf_nl () "ERROR: Not enough XML entries %d/%d"
                     (List.length files) (List.length user_files);
                 user_files 
               end
Index: mldonkey/src/networks/gnutella2/g2Proto.ml
diff -u mldonkey/src/networks/gnutella2/g2Proto.ml:1.14 
mldonkey/src/networks/gnutella2/g2Proto.ml:1.15
--- mldonkey/src/networks/gnutella2/g2Proto.ml:1.14     Sun Dec 18 14:50:38 2005
+++ mldonkey/src/networks/gnutella2/g2Proto.ml  Wed Jan 11 19:12:35 2006
@@ -612,7 +612,7 @@
     if be then 
       (
        if !verbose then
-         lprintf_nl "Big Endian not supported yet";
+         lprintf_nl () "Big Endian not supported yet";
        raise Exit
       );
     let module M = G2_LittleEndian in
@@ -1129,7 +1129,7 @@
         | 3, false -> LittleEndian.get_int24 buf (pos+1), 4
         | _ ->
             if !verbose then
-              lprintf_nl "no correct pkt_len, pkt_pos";
+              lprintf_nl () "no correct pkt_len, pkt_pos";
             0, 1
       in
       let name_len = ((cb lsr 3) land 7) + 1 in
@@ -1513,7 +1513,7 @@
         | 3, false -> LittleEndian.get_int24 buf (pos+1), 4
         | _ ->
             if !verbose then
-              lprintf_nl "no correct pkt_len, pkt_pos";
+              lprintf_nl () "no correct pkt_len, pkt_pos";
             0, 1
       in
       let name_len = ((cb lsr 3) land 7) + 1 in




reply via email to

[Prev in Thread] Current Thread [Next in Thread]