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: Thu, 25 Jan 2007 13:06:46 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/01/25 13:06:46

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonSwarming.ml 

Log message:
        patch #5710

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1161&r2=1.1162
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonSwarming.ml?cvsroot=mldonkey&r1=1.55&r2=1.56

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1161
retrieving revision 1.1162
diff -u -b -r1.1161 -r1.1162
--- distrib/ChangeLog   21 Jan 2007 15:50:27 -0000      1.1161
+++ distrib/ChangeLog   25 Jan 2007 13:06:45 -0000      1.1162
@@ -14,6 +14,9 @@
 ChangeLog
 =========
 
+2007/01/25
+5710: Swarmer: Fix chunk propagation (pango)
+
 2007/01/21
 5693: "voo changed" prints changed options only, useful for support (Schlumpf)
 5698: EDK: fix display of porttest result images (Schlumpf)

Index: src/daemon/common/commonSwarming.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSwarming.ml,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- src/daemon/common/commonSwarming.ml 6 Jan 2007 17:37:11 -0000       1.55
+++ src/daemon/common/commonSwarming.ml 25 Jan 2007 13:06:46 -0000      1.56
@@ -2935,16 +2935,12 @@
   mutable occurrence_missing : chunk_occurrence list;
 }
 
-let propagate_chunk t1 pos1 size destinations copy_data =
+let propagate_chunk t1 pos1 size destinations =
   List.iter (fun (t2, j2, pos2) ->
     if t1.t_num <> t2.t_num || pos1 <> pos2 then begin
       if !verbose then lprintf_nl "Should propagate chunk from %s %Ld to %s 
%Ld [%Ld]"
         (file_best_name t1.t_file) pos1
         (file_best_name t2.t_file) pos2 size;
-      (* small catch here: if we don't really copy the data *and*
-        chunk content is not the expected value, the chunk will be
-        verified each time *)
-      if copy_data then
        Unix32.copy_chunk (file_fd t1.t_file)  (file_fd t2.t_file)
          pos1 pos2 (Int64.to_int size);
       set_frontend_state_complete t2 j2
@@ -2954,10 +2950,6 @@
 let dummy_chunk_occurrences () = 
   { occurrence_present = []; occurrence_missing = [] }
 
-(* Compute the digest of zeroed chunks to avoid copying them *)
-let known_chunks_sizes : (int64, unit) Hashtbl.t = Hashtbl.create 5
-let zeroed_chunks_hashes : (uid_type, unit) Hashtbl.t = Hashtbl.create 5
-
 let duplicate_chunks () =
   let chunks = Hashtbl.create 100 in
   HS.iter (fun s ->
@@ -2971,25 +2963,6 @@
                chunk_uid = uids.(j);
                chunk_size = min (s.s_size -- pos) t.t_chunk_size;
               } in
-             (try
-               ignore (Hashtbl.find known_chunks_sizes c.chunk_size)
-             with Not_found ->
-               (* new chunk size, compute hashes for zeroed chunk of
-                  that size.
-                  No chunk size is bigger than 16MB I hope *)
-               if c.chunk_size < Int64.of_int (16 * 1024 * 1024) then begin
-                 let chunk_size = Int64.to_int c.chunk_size in
-                 let zeroed_buffer = String.make chunk_size '\000' in
-
-                 Hashtbl.add zeroed_chunks_hashes
-                   (Ed2k (Md4.Md4.string zeroed_buffer)) ();
-                 Hashtbl.add zeroed_chunks_hashes
-                   (Sha1 (Md4.Sha1.string zeroed_buffer)) ();
-                 Hashtbl.add zeroed_chunks_hashes
-                   (TigerTree (Md4.TigerTree.string zeroed_buffer)) ()
-               end;
-               Hashtbl.add known_chunks_sizes c.chunk_size ();
-             );
              let occurrences = 
                try
                  Hashtbl.find chunks c
@@ -3012,19 +2985,14 @@
     ) s.s_networks
   ) swarmers_by_name;
   Hashtbl.iter (fun c occurrences ->
+    (* we need a verified chunk to copy over the others *)
     match occurrences.occurrence_present, occurrences.occurrence_missing with
     | _ , []
     | [], _ -> ()
     | (t, _, pos) :: _, missing ->
-       let is_zeroed_chunk =
-         try
-           ignore(Hashtbl.find zeroed_chunks_hashes c.chunk_uid);
-           false
-         with Not_found -> true in
-        propagate_chunk t pos c.chunk_size missing (not is_zeroed_chunk)
+        propagate_chunk t pos c.chunk_size missing
   ) chunks
 
-
 let set_verifier t f =
   t.t_verifier <- f;
 (* TODO: check that false as t_primary is a good value to start with *)




reply via email to

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