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: Sun, 17 Jun 2007 01:56:30 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/06/17 01:56:30

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonFile.ml commonFile.mli 
                           commonSwarming.ml commonTypes.ml 
        src/daemon/driver: driverCommands.ml 
        src/networks/bittorrent: bTInteractive.ml 
        src/networks/donkey: donkeyInteractive.ml 
        src/networks/fileTP: fileTPInteractive.ml 
        src/networks/gnutella: gnutellaInteractive.ml 

Log message:
        patch #6005

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1282&r2=1.1283
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonFile.ml?cvsroot=mldonkey&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonFile.mli?cvsroot=mldonkey&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonSwarming.ml?cvsroot=mldonkey&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonTypes.ml?cvsroot=mldonkey&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.233&r2=1.234
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.138&r2=1.139
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyInteractive.ml?cvsroot=mldonkey&r1=1.158&r2=1.159
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/fileTP/fileTPInteractive.ml?cvsroot=mldonkey&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/gnutella/gnutellaInteractive.ml?cvsroot=mldonkey&r1=1.71&r2=1.72

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1282
retrieving revision 1.1283
diff -u -b -r1.1282 -r1.1283
--- distrib/ChangeLog   17 Jun 2007 01:33:38 -0000      1.1282
+++ distrib/ChangeLog   17 Jun 2007 01:56:28 -0000      1.1283
@@ -15,6 +15,10 @@
 =========
 
 2007/06/17
+6005: Swarmer: Implement new download mechanism
+- its now possible to switch the order blocks are downloaded from random
+  (first and last block first, default) to linear
+- new command: download_order <file number> <random|linear>
 6017: Multiuser: New optional parameters group/commit_dir for command useradd
 6020: Multiuser: Fix handling of user "admin", its user_commit_dir was not
       used when MLDonkey was not restarted between download start and commit

Index: src/daemon/common/commonFile.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.ml,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- src/daemon/common/commonFile.ml     17 Jun 2007 01:28:24 -0000      1.74
+++ src/daemon/common/commonFile.ml     17 Jun 2007 01:56:29 -0000      1.75
@@ -85,6 +85,7 @@
     mutable op_file_pause : ('a -> unit);
     mutable op_file_queue : ('a -> unit);
     mutable op_file_resume : ('a -> unit);
+    mutable op_file_download_order : ('a -> swarming_strategy option -> 
swarming_strategy option);
     mutable op_file_info : ('a -> GuiTypes.file_info);
     mutable op_file_set_format : ('a -> CommonTypes.format -> unit);
     mutable op_file_check : ('a -> unit);
@@ -565,6 +566,19 @@
       [| Filename2.basename !!previewer; file_disk_name file; file_best_name 
file |]
       Unix.stdin Unix.stdout Unix.stderr)
 
+let file_download_order (file : file) strategy =
+  let file = as_file_impl file in
+  file.impl_file_ops.op_file_download_order file.impl_file_val strategy
+
+let file_print_download_order (file : file) =
+  let file = as_file_impl file in
+  match file.impl_file_ops.op_file_download_order file.impl_file_val None with
+  | None -> "unknown"
+  | Some strategy ->
+      match strategy with
+      | LinearStrategy -> "linear"
+      | AdvancedStrategy -> "random"
+
 (*************************************************************************)
 (*                                                                       *)
 (*                         file_downloaders                              *)
@@ -772,6 +786,11 @@
 
       Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" 
(html_mods_cntr ());
       html_mods_td buf [
+        ("Download strategy", "sr br", "DL strategy");
+        ("", "sr", file_print_download_order file) ];
+
+      Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" 
(html_mods_cntr ());
+      html_mods_td buf [
         ("Number of file sources", "sr br", "Sources");
         ("", "sr", Printf.sprintf "%d" (List.length srcs)) ];
 
@@ -997,6 +1016,7 @@
       op_file_pause = (fun _ -> ni_ok network "file_pause");
       op_file_queue = (fun _ -> ni_ok network "file_queue");
       op_file_resume = (fun _ -> ni_ok network "file_resume");
+      op_file_download_order = (fun _ _ -> None);
 (*      op_file_disk_name = (fun _ -> fni network "file_disk_name"); *)
       op_file_check = (fun _ -> ni_ok network "file_check");
       op_file_recover = (fun _ -> ni_ok network "file_recover");
@@ -1038,6 +1058,8 @@
         lprintf_nl "op_file_queue";
       if c.op_file_resume == cc.op_file_resume then
         lprintf_nl "op_file_resume";
+      if c.op_file_download_order == cc.op_file_download_order then
+        lprintf_nl "op_file_download_order";
 (*      if c.op_file_disk_name == cc.op_file_disk_name then
         lprintf_nl "op_file_disk_name"; *)
       if c.op_file_check == cc.op_file_check then

Index: src/daemon/common/commonFile.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.mli,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- src/daemon/common/commonFile.mli    1 Jun 2007 19:43:41 -0000       1.32
+++ src/daemon/common/commonFile.mli    17 Jun 2007 01:56:29 -0000      1.33
@@ -52,6 +52,7 @@
   mutable op_file_pause : 'a -> unit;
   mutable op_file_queue : 'a -> unit;
   mutable op_file_resume : 'a -> unit;
+  mutable op_file_download_order : 'a -> CommonTypes.swarming_strategy option 
-> CommonTypes.swarming_strategy option;
   mutable op_file_info : 'a -> GuiTypes.file_info;
   mutable op_file_set_format : 'a -> CommonTypes.format -> unit;
   mutable op_file_check : 'a -> unit;
@@ -124,6 +125,8 @@
 val file_downloaded : CommonTypes.file -> int64
 val file_network : CommonTypes.file -> CommonTypes.network
 val file_priority : CommonTypes.file -> int
+val file_download_order : CommonTypes.file -> CommonTypes.swarming_strategy 
option -> CommonTypes.swarming_strategy option
+val file_print_download_order : CommonTypes.file -> string
 val set_file_priority : CommonTypes.file -> int -> unit
 val set_file_last_seen : CommonTypes.file -> int -> unit
 val file_debug : CommonTypes.file -> string

Index: src/daemon/common/commonSwarming.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSwarming.ml,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- src/daemon/common/commonSwarming.ml 7 Jun 2007 23:21:50 -0000       1.63
+++ src/daemon/common/commonSwarming.ml 17 Jun 2007 01:56:29 -0000      1.64
@@ -53,10 +53,6 @@
 
 let debug_all = false
 
-type strategy =
-  LinearStrategy    (* one after the other one *)
-| AdvancedStrategy
-
 exception VerifierNotReady
 
 type intervals =
@@ -144,7 +140,7 @@
 
     mutable s_networks : t list; (** list of frontends, primary at head 
                                     t.t_s = s <=> t in s.s_networks *)
-    mutable s_strategy : strategy;
+    mutable s_strategy : swarming_strategy;
 
     mutable s_verified_bitmap : VerificationBitmap.t;
     mutable s_disk_allocated : Bitv.t;
@@ -2477,6 +2473,10 @@
 let in_uploader_ranges r list =
   List.exists (fun (_,_,r') -> r' == r) list
 
+let set_strategy t strategy = t.t_s.s_strategy <- strategy
+
+let get_strategy t = t.t_s.s_strategy
+
 (*************************************************************************)
 (*                                                                       *)
 (*                         find_range                                    *)
@@ -3242,6 +3242,12 @@
           let file_size = get_value "file_size" value_to_int64 in
           let file_name = get_value "file_name" value_to_string in
           let s = create_swarmer file_name file_size in
+         (let order =
+            try
+              get_value "file_download_random" value_to_bool
+            with _ -> true
+           in
+           s.s_strategy <- if order then AdvancedStrategy else LinearStrategy);
          (try
            let bitmap = Bitv.of_string (get_value "file_disk_allocation_bitmap"
              value_to_string) in
@@ -3267,6 +3273,10 @@
          (Bitv.to_string s.s_disk_allocated));
         ("file_chunk_sizes", list_to_value int64_to_value
             (List.map (fun t -> t.t_chunk_size) s.s_networks));
+        ("file_download_random", bool_to_value
+            (match s.s_strategy with
+             | AdvancedStrategy -> true
+             | LinearStrategy -> false));
         ]
 
     let t =

Index: src/daemon/common/commonTypes.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonTypes.ml,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- src/daemon/common/commonTypes.ml    26 May 2007 23:21:46 -0000      1.70
+++ src/daemon/common/commonTypes.ml    17 Jun 2007 01:56:29 -0000      1.71
@@ -970,3 +970,7 @@
   | SmallFileSlot -> "SmallFileSlot"
   | NormalSlot -> if short then "" else "NormalSlot"
   | PrioSlot dir -> Printf.sprintf "Prio %s" dir
+
+type swarming_strategy =
+  LinearStrategy    (* one after the other one *)
+| AdvancedStrategy

Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -b -r1.233 -r1.234
--- src/daemon/driver/driverCommands.ml 17 Jun 2007 01:33:39 -0000      1.233
+++ src/daemon/driver/driverCommands.ml 17 Jun 2007 01:56:29 -0000      1.234
@@ -2866,6 +2866,17 @@
 
     ), "<priority> <files numbers> :\tchange file priorities";
 
+    "download_order", Arg_two (fun num v o ->
+        try
+          let file = file_find (int_of_string num) in
+          (match v with
+          | "linear" -> ignore (CommonFile.file_download_order file (Some 
CommonTypes.LinearStrategy))
+          | _ -> ignore (CommonFile.file_download_order file (Some 
CommonTypes.AdvancedStrategy)));
+          _s (Printf.sprintf "Changed download order of %s to %s"
+                (file_best_name file) (file_print_download_order file))
+        with e -> Printf.sprintf "Exception %s" (Printexc2.to_string e)
+    ), "<file number> <random|linear> :\tchange download order of file blocks 
(default random, with first and last block first)";
+
     "confirm", Arg_one (fun arg o ->
         match String.lowercase arg with
           "yes" | "y" | "true" ->

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -b -r1.138 -r1.139
--- src/networks/bittorrent/bTInteractive.ml    17 Jun 2007 01:28:25 -0000      
1.138
+++ src/networks/bittorrent/bTInteractive.ml    17 Jun 2007 01:56:29 -0000      
1.139
@@ -1256,6 +1256,16 @@
         None -> None
       | Some sh -> Some (as_shared sh)
   );
+  file_ops.op_file_download_order <- (fun file strategy ->
+      match file.file_swarmer with
+      | None -> None
+      | Some s ->
+          (match strategy with
+          (* return current strategy *)
+          | None -> Some (CommonSwarming.get_strategy s)
+          | Some strategy -> CommonSwarming.set_strategy s strategy;
+                      Some (CommonSwarming.get_strategy s))
+  );
 
   network.op_network_gui_message <- op_gui_message;
   network.op_network_connected <- op_network_connected;

Index: src/networks/donkey/donkeyInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -b -r1.158 -r1.159
--- src/networks/donkey/donkeyInteractive.ml    17 Jun 2007 01:28:25 -0000      
1.158
+++ src/networks/donkey/donkeyInteractive.ml    17 Jun 2007 01:56:29 -0000      
1.159
@@ -1012,6 +1012,16 @@
 
 let _ =
   register_commands commands;
+  file_ops.op_file_download_order <- (fun file strategy ->
+      match file.file_swarmer with
+      | None -> None
+      | Some s ->
+          (match strategy with
+          (* return current strategy *)
+          | None -> Some (CommonSwarming.get_strategy s)
+          | Some strategy -> CommonSwarming.set_strategy s strategy;
+                      Some (CommonSwarming.get_strategy s))
+  );
   file_ops.op_file_resume <- (fun file ->
       reconnect_all file;
   );

Index: src/networks/fileTP/fileTPInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/fileTP/fileTPInteractive.ml,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- src/networks/fileTP/fileTPInteractive.ml    1 Jun 2007 19:43:41 -0000       
1.57
+++ src/networks/fileTP/fileTPInteractive.ml    17 Jun 2007 01:56:30 -0000      
1.58
@@ -423,6 +423,16 @@
       | _ -> ()
     ) file.file_clients
   );
+  file_ops.op_file_download_order <- (fun file strategy ->
+      match file.file_swarmer with
+      | None -> None
+      | Some s ->
+          (match strategy with
+          (* return current strategy *)
+          | None -> Some (CommonSwarming.get_strategy s)
+          | Some strategy -> CommonSwarming.set_strategy s strategy;
+                      Some (CommonSwarming.get_strategy s))
+  );
   file_ops.op_file_queue <- file_ops.op_file_pause;
   file_ops.op_file_resume <- (fun file -> ());
   file_ops.op_file_print <- (fun file buf -> ());

Index: src/networks/gnutella/gnutellaInteractive.ml
===================================================================
RCS file: 
/sources/mldonkey/mldonkey/src/networks/gnutella/gnutellaInteractive.ml,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- src/networks/gnutella/gnutellaInteractive.ml        31 May 2007 19:24:59 
-0000      1.71
+++ src/networks/gnutella/gnutellaInteractive.ml        17 Jun 2007 01:56:30 
-0000      1.72
@@ -285,6 +285,16 @@
           GnutellaServers.get_file_from_source c file
       ) file.file_clients
   );
+  file_ops.op_file_download_order <- (fun file strategy ->
+      match file.file_swarmer with
+      | None -> None
+      | Some s ->
+          (match strategy with
+          (* return current strategy *)
+          | None -> Some (CommonSwarming.get_strategy s)
+          | Some strategy -> CommonSwarming.set_strategy s strategy;
+                      Some (CommonSwarming.get_strategy s))
+  )
   
 module P = GuiTypes
   




reply via email to

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