mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...
Date: Sat, 16 Sep 2006 09:47:17 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/09/16 09:47:17

Modified files:
        distrib        : ChangeLog 
        src/networks/bittorrent: bTClients.ml bTComplexOptions.ml 
                                 bTGlobals.ml bTInteractive.ml 

Log message:
        patch #5380

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1008&r2=1.1009
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTClients.ml?cvsroot=mldonkey&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTComplexOptions.ml?cvsroot=mldonkey&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTGlobals.ml?cvsroot=mldonkey&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.107&r2=1.108

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1008
retrieving revision 1.1009
diff -u -b -r1.1008 -r1.1009
--- distrib/ChangeLog   16 Sep 2006 09:38:59 -0000      1.1008
+++ distrib/ChangeLog   16 Sep 2006 09:47:17 -0000      1.1009
@@ -15,6 +15,7 @@
 =========
 
 2006/09/16
+5380: BT: Add file_num to certain log entries (jave)
 5392: fix typos in help texts (schlotter)
 5394: Fix max_hard_up/download_rate computation
 - crashed on Windows when max_hard_upload_rate = 0

Index: src/networks/bittorrent/bTClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTClients.ml,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- src/networks/bittorrent/bTClients.ml        12 Sep 2006 22:44:09 -0000      
1.76
+++ src/networks/bittorrent/bTClients.ml        16 Sep 2006 09:47:17 -0000      
1.77
@@ -322,7 +322,7 @@
   if not ( !must_keep && (client_has_a_slot (as_client c) || 
c.client_interested)) then
     begin
       if !verbose_msg_clients then
-        lprintf_nl "disconnect since download is finished";
+        lprintf_file_nl file "disconnect since download is finished";
       disconnect_client c Closed_by_user
     end
   ) file.file_clients
@@ -436,12 +436,12 @@
 
     let file = Hashtbl.find files_by_uid file_id in
     if !verbose_msg_clients then
-      lprintf_nl "file found";
+      lprintf_file_nl file "file found";
     let c =
       match !cc with
         None ->
           let c = new_client file Sha1.null (TcpBufferedSocket.peer_addr sock) 
in
-          if !verbose_connect then lprintf_nl "Client %d: incoming connection" 
(client_num c);
+          if !verbose_connect then lprintf_file_nl file "Client %d: incoming 
connection" (client_num c);
           cc := Some c;
           c
       | Some c ->
@@ -604,7 +604,7 @@
     let num, x,y, r =
 
       if !verbose_msg_clients then begin
-        lprintf_nl "CLIENT %d: Finding new range to send" (client_num c);
+        lprintf_file_nl file "CLIENT %d: Finding new range to send" 
(client_num c);
       end;
 
       if !verbose_swarming then begin
@@ -638,7 +638,7 @@
 
         lprint_newline ();
       
-        lprintf_nl "Finding Range:";
+        lprintf_file_nl file "Finding Range:";
       end;
 
       try
@@ -653,7 +653,7 @@
 
           | None -> 
 
-              if !verbose_swarming then lprintf_nl "No block";
+              if !verbose_swarming then lprintf_file_nl file "No block";
               update_client_bitmap c;
               (try CommonSwarming.verify_one_chunk swarmer with _ -> ());
               (*Find a free block in the swarmer*)
@@ -707,7 +707,7 @@
    number. Only matters with merged downloads, and even then other
    clients didn't seem to care (?), so the bug remained hidden *)
                   if !verbose_swarming then 
-                    lprintf_nl "Asking %d For Range %Ld-%Ld" chunk x y;
+                    lprintf_file_nl file "Asking %d For Range %Ld-%Ld" chunk x 
y;
                       
                   chunk, x -- file.file_piece_size ** Int64.of_int chunk, y -- 
x, r
 
@@ -742,12 +742,12 @@
     send_client c (Request (num,x,y));
 
     if !verbose_msg_clients then
-      lprintf_nl "CLIENT %d: Asking %s For Range %Ld-%Ld"
+      lprintf_file_nl file "CLIENT %d: Asking %s For Range %Ld-%Ld"
         (client_num c) (Sha1.to_string c.client_uid) x y
 
   with Not_found ->
         if not (CommonSwarming.check_finished swarmer) && !verbose_download 
then
-          lprintf_nl "BTClient.get_from_client ERROR: can't find a block to 
download and file is not yet finished for file : %s..." file.file_name
+          lprintf_file_nl file "BTClient.get_from_client ERROR: can't find a 
block to download and file is not yet finished for file : %s..." file.file_name
 
 
 (** In this function we match a message sent by a client
@@ -799,10 +799,10 @@
 
             if !verbose_msg_clients then
               (match c.client_ranges_sent with
-                  [] -> lprintf_nl "EMPTY Ranges !!!"
+                  [] -> lprintf_file_nl file "EMPTY Ranges !!!"
                 | (p1,p2,r) :: _ ->
                     let (x,y) = CommonSwarming.range_range r in
-                    lprintf_nl "Current range from %s : %Ld [%d] (asked 
%Ld-%Ld[%Ld-%Ld])"
+                    lprintf_file_nl file "Current range from %s : %Ld [%d] 
(asked %Ld-%Ld[%Ld-%Ld])"
                       (brand_to_string c.client_brand) position len
                       p1 p2 x y
               );
@@ -822,10 +822,10 @@
             Rate.update c.client_downloaded_rate  (float_of_int len);
             if !verbose_msg_clients then
               (match c.client_ranges_sent with
-                  [] -> lprintf_nl "EMPTY Ranges !!!"
+                  [] -> lprintf_file_nl file "EMPTY Ranges !!!"
                 | (p1,p2,r) :: _ ->
                     let (x,y) = CommonSwarming.range_range r in
-                    lprintf_nl "Received %Ld [%d] %Ld-%Ld[%Ld-%Ld] -> %Ld"
+                    lprintf_file_nl file "Received %Ld [%d] %Ld-%Ld[%Ld-%Ld] 
-> %Ld"
                       position len
                       p1 p2 x y
                       (new_downloaded -- old_downloaded)
@@ -911,7 +911,7 @@
               let nbits = String.length p * 8 in
 
               if nbits < npieces then begin
-                lprintf_nl "Error: expected bitfield of atleast %d but got %d" 
npieces nbits;
+                lprintf_file_nl file "Error: expected bitfield of atleast %d 
but got %d" npieces nbits;
                 disconnect_client c (Closed_for_error "Wrong bitfield length")
               end else begin
 
@@ -934,7 +934,7 @@
                   send_interested c;
 
                 if !verbose_msg_clients then
-                  lprintf_nl "New BitField Registered";
+                  lprintf_file_nl file "New BitField Registered";
 
                 (*  for i = 1 to max_range_requests - List.length 
c.client_ranges do
                       (try get_from_client sock c with _ -> ())
@@ -1003,7 +1003,7 @@
                 (* Afaik this is no protocol violation and happens if the 
client
                    didn't send a client bitmap after the handshake. *)
                 let (ip,port) = c.client_host in
-                  if !verbose_msg_clients then lprintf_nl "%s:%d with software 
%s : Choke send, but no client bitmap"
+                  if !verbose_msg_clients then lprintf_file_nl file "%s:%d 
with software %s : Choke send, but no client bitmap"
                     (Ip.to_string ip) port (brand_to_string c.client_brand)
             | Some up ->
                 CommonSwarming.clear_uploader_intervals up
@@ -1068,10 +1068,10 @@
           c.client_upload_requests <- List2.remove_first (n, pos, len) 
c.client_upload_requests
         else
           if !verbose_msg_clients then
-            lprintf_nl "Error: received cancel request but client has no slot"
+            lprintf_file_nl file "Error: received cancel request but client 
has no slot"
 
   with e ->
-      lprintf_nl "Error %s while handling MESSAGE: %s" (Printexc2.to_string e) 
(TcpMessages.to_string msg)
+      lprintf_file_nl file "Error %s while handling MESSAGE: %s" 
(Printexc2.to_string e) (TcpMessages.to_string msg)
 
 
 (** The function used to connect to a client.
@@ -1136,7 +1136,7 @@
                   let file = c.client_file in
 
                   if !verbose_msg_clients then
-                    lprintf_nl "READY TO DOWNLOAD FILE";
+                    lprintf_file_nl file "READY TO DOWNLOAD FILE";
 
                   send_init !!client_uid file.file_id sock;
 (* Fabrice: Initialize the client bitmap and uploader fields to <> None *)
@@ -1284,7 +1284,7 @@
              with _ -> ())
       with e ->
           if !verbose_connect then
-            lprintf_nl "Exception %s in resume_clients"   (Printexc2.to_string 
e)
+            lprintf_file_nl file "Exception %s in resume_clients"   
(Printexc2.to_string e)
   ) file.file_clients
 
 (** Check if the value replied by the tracker is correct.
@@ -1321,13 +1321,13 @@
     let tracker_reply =
       try
         File.to_string filename
-      with e -> lprintf_nl "Empty reply from tracker"; ""
+      with e -> lprintf_file_nl file "Empty reply from tracker"; ""
     in
     let v =
        match tracker_reply with
        | "" ->
         if !verbose_connect then
-          lprintf_nl "Empty reply from tracker";
+          lprintf_file_nl file "Empty reply from tracker";
         Bencode.decode ""
        | _ -> Bencode.decode tracker_reply
     in
@@ -1342,10 +1342,10 @@
                 (* On failure, remove the faulty tracker from 
file.file_trackers list *)
                t.tracker_enabled <- false;
                (* remove_tracker t.tracker_url file; *)
-                lprintf_nl "Failure from Tracker %s in file: %s Reason: 
%s\nBT: Tracker %s disabled for failure"
+                lprintf_file_nl file "Failure from Tracker %s in file: %s 
Reason: %s\nBT: Tracker %s disabled for failure"
                   t.tracker_url file.file_name (Charset.to_utf8 failure) 
t.tracker_url
             | String "warning message", String warning ->
-                lprintf_nl "Warning from Tracker %s in file: %s Reason: %s" 
t.tracker_url file.file_name warning
+                lprintf_file_nl file "Warning from Tracker %s in file: %s 
Reason: %s" t.tracker_url file.file_name warning
             | String "interval", Int n ->
                 t.tracker_interval <- chk_keyval (Bencode.print key) n 
t.tracker_url file.file_name;
                 (* in case we don't receive "min interval" *)
@@ -1376,11 +1376,11 @@
             | String "key", String n ->
                 t.tracker_key <- n;
                 if !verbose_msg_clients then
-                  lprintf_nl "%s in file: %s has key: %s" t.tracker_url 
file.file_name n
+                  lprintf_file_nl file "%s in file: %s has key: %s" 
t.tracker_url file.file_name n
             | String "tracker id", String n ->
                 t.tracker_id <- n;
                 if !verbose_msg_clients then
-                  lprintf_nl "%s in file: %s has tracker id %s" t.tracker_url 
file.file_name n
+                  lprintf_file_nl file "%s in file: %s has tracker id %s" 
t.tracker_url file.file_name n
 
             | String "peers", List list ->
                 List.iter (fun v ->
@@ -1412,13 +1412,13 @@
                               None -> true
                             | Some reason ->
                                 if !verbose_connect then
-                                  lprintf_nl "%s:%d blocked: %s"
+                                  lprintf_file_nl file "%s:%d blocked: %s"
                                     (Ip.to_string !peer_ip) !port reason;
                                 false)
                         then
                           let _ = new_client file !peer_id (!peer_ip,!port)
                           in
-                          if !verbose_sources > 1 then lprintf_nl "Received 
%s:%d" (Ip.to_string !peer_ip)
+                          if !verbose_sources > 1 then lprintf_file_nl file 
"Received %s:%d" (Ip.to_string !peer_ip)
                           !port;
                           ()
                     | _ -> assert false
@@ -1439,12 +1439,12 @@
             | String "private", Int n -> ()
               (* TODO: if set to 1, disable peer exchange *)
 
-            | _ -> lprintf_nl "received unknown entry in answer from tracker: 
%s : %s" (Bencode.print key) (Bencode.print value)
+            | _ -> lprintf_file_nl file "received unknown entry in answer from 
tracker: %s : %s" (Bencode.print key) (Bencode.print value)
         ) list;
        (*Now, that we have added new clients to a file, it's time
          to connect to them*)
         if !verbose_sources > 0 then
-          lprintf_nl "get_sources_from_tracker: got %i source(s) for file %s"
+          lprintf_file_nl file "get_sources_from_tracker: got %i source(s) for 
file %s"
             t.tracker_last_clients_num file.file_name;
         resume_clients file
 
@@ -1473,7 +1473,7 @@
               (try
                   connect_trackers file "" (fun _ _ -> ()) with _ -> ())
           | FilePaused -> () (*when we are paused we do nothing, not even 
logging this vvvv*)
-          | s -> lprintf_nl "Other state %s!!" (string_of_state s)
+          | s -> lprintf_file_nl file "Other state %s!!" (string_of_state s)
       ) !current_files
 
 let upload_buffer = String.create 100000
@@ -1573,7 +1573,7 @@
     if file.file_tracker_connected then
     begin
       connect_trackers file "stopped" (fun _ _ ->
-          lprintf_nl "Tracker return: stopped %s" file.file_name;
+          lprintf_file_nl file "Tracker return: stopped %s" file.file_name;
           file.file_tracker_connected <- false)
     end
 

Index: src/networks/bittorrent/bTComplexOptions.ml
===================================================================
RCS file: 
/sources/mldonkey/mldonkey/src/networks/bittorrent/bTComplexOptions.ml,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- src/networks/bittorrent/bTComplexOptions.ml 12 Aug 2006 20:36:14 -0000      
1.35
+++ src/networks/bittorrent/bTComplexOptions.ml 16 Sep 2006 09:47:17 -0000      
1.36
@@ -249,7 +249,7 @@
         CommonSwarming.frontend_to_value swarmer assocs
   with
     e ->
-      lprintf_nl "exception %s in file_to_value"
+      lprintf_file_nl file "exception %s in file_to_value"
         (Printexc2.to_string e); raise e
 
 

Index: src/networks/bittorrent/bTGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTGlobals.ml,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- src/networks/bittorrent/bTGlobals.ml        12 Sep 2006 22:44:52 -0000      
1.62
+++ src/networks/bittorrent/bTGlobals.ml        16 Sep 2006 09:47:17 -0000      
1.63
@@ -126,6 +126,10 @@
 let lprintf_nl fmt =
   lprintf_nl2 log_prefix fmt
 
+let lprintf_file_nl  file fmt  =
+  lprintf_nl2 (log_prefix^" [file_num "^(string_of_int (file_num file))^"]") 
fmt
+
+    
 let lprintf_n fmt =
   lprintf2 log_prefix fmt
 

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- src/networks/bittorrent/bTInteractive.ml    16 Sep 2006 09:38:59 -0000      
1.107
+++ src/networks/bittorrent/bTInteractive.ml    16 Sep 2006 09:47:17 -0000      
1.108
@@ -101,7 +101,7 @@
       set_file_state file FileShared;
 
       if Unix32.destroyed (file_fd file) then
-        if !verbose then lprintf_nl "op_file_commit: FD is destroyed... 
repairing";
+        if !verbose then lprintf_file_nl file "op_file_commit: FD is 
destroyed... repairing";
 
 (* During the commit operation, for security, the file_fd is destroyed. So
   we create it again to be able to share this file again. *)
@@ -110,7 +110,7 @@
         (create_temp_file new_name (List.map (fun (file,size,_) -> 
(file,size)) file.file_files) (file_state file));
 
       if Unix32.destroyed (file_fd file) then
-        lprintf_nl "op_file_commit: FD is destroyed... could not repair!";
+        lprintf_file_nl file "op_file_commit: FD is destroyed... could not 
repair!";
 
       let new_torrent_diskname =
         Filename.concat seeded_directory
@@ -119,7 +119,7 @@
       (try
           Unix2.rename file.file_torrent_diskname new_torrent_diskname;
         with _ ->
-          (lprintf_nl "op_file_commit: failed to rename %s to %s"
+          (lprintf_file_nl file "op_file_commit: failed to rename %s to %s"
               file.file_torrent_diskname new_torrent_diskname));
       file.file_torrent_diskname <- new_torrent_diskname;
 
@@ -383,10 +383,10 @@
     end
 
 let op_file_check file =
-  lprintf_nl "Checking chunks of %s" file.file_name;
+  lprintf_file_nl file "Checking chunks of %s" file.file_name;
   match file.file_swarmer with
     None ->
-      lprintf_nl "verify_chunks: no swarmer to verify chunks"
+      lprintf_file_nl file "verify_chunks: no swarmer to verify chunks"
   | Some swarmer ->
       CommonSwarming.verify_all_chunks_immediately swarmer
 
@@ -516,21 +516,21 @@
 (*This is the function which will be called by the http client
 for parsing the response*)
 (* Interested only in interval*)
-  if !verbose_msg_servers then lprintf_nl "Filename %s" filename;
+  if !verbose_msg_servers then lprintf_file_nl file "Filename %s" filename;
     let tracker_reply =
       try
         File.to_string filename
-      with e -> lprintf_nl "Empty reply from tracker"; ""
+      with e -> lprintf_file_nl file "Empty reply from tracker"; ""
     in
     let v =
        match tracker_reply with
        | "" ->
         if !verbose_connect then
-          lprintf_nl "Empty reply from tracker";
+          lprintf_file_nl file "Empty reply from tracker";
         Bencode.decode ""
        | _ -> Bencode.decode tracker_reply
     in
-  if !verbose_msg_servers then lprintf_nl "Received: %s" (Bencode.print v);
+  if !verbose_msg_servers then lprintf_file_nl file "Received: %s" 
(Bencode.print v);
   t.tracker_interval <- 600;
   match v with
     Dictionary list ->
@@ -538,9 +538,9 @@
           match (key, value) with
             String "interval", Int n ->
               t.tracker_interval <- Int64.to_int n;
-              if !verbose_msg_servers then lprintf_nl ".. interval %d .." 
t.tracker_interval
+              if !verbose_msg_servers then lprintf_file_nl file ".. interval 
%d .." t.tracker_interval
           | String "failure reason", String failure ->
-                lprintf_nl "Failure from Tracker in file: %s Reason: %s" 
file.file_name failure
+                lprintf_file_nl file "Failure from Tracker in file: %s Reason: 
%s"  file.file_name failure
           (*TODO: merge with f from get_sources_from_tracker and parse the 
rest of the answer, too.
             also connect to the sources we receive or instruct tracker to send 
none, perhaps based
             on an config option. firewalled people could activate the option 
and then seed torrents, too.*)
@@ -578,7 +578,7 @@
     let file = new_file file_id torrent torrent_diskname
         filename FileShared in
     BTShare.must_share_file file;
-    if !verbose_share then lprintf_nl "Sharing file %s" filename;
+    if !verbose_share then lprintf_file_nl file "Sharing file %s" filename;
     BTClients.connect_trackers file "started"
       (parse_tracker_reply file)
   with
@@ -986,7 +986,7 @@
           Hashtbl.iter (fun _ file ->
               if file_num file = num then begin
                   if !verbose then
-                    lprintf_nl "adding trackers for file %i" num;
+                    lprintf_file_nl file "adding trackers for file %i" num;
                   set_trackers file !urls;
                   raise Exit
                 end
@@ -1101,7 +1101,7 @@
   CommonNetwork.register_commands commands;
 
   shared_ops.op_shared_unshare <- (fun file ->
-      (if !verbose_share then lprintf_nl "unshare file");
+      (if !verbose_share then lprintf_file_nl file "unshare file");
       BTShare.unshare_file file);
   shared_ops.op_shared_info <- (fun file ->
    let module T = GuiTypes in




reply via email to

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