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: Sun, 15 Aug 2010 15:05:19 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       10/08/15 15:05:19

Modified files:
        distrib        : ChangeLog 
        src/networks/bittorrent: bTTorrent.ml 
        src/utils/lib  : unix32.ml 
        tools          : make_torrent.ml 

Log message:
        patch #7280

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1459&r2=1.1460
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTTorrent.ml?cvsroot=mldonkey&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/unix32.ml?cvsroot=mldonkey&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/mldonkey/tools/make_torrent.ml?cvsroot=mldonkey&r1=1.9&r2=1.10

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1459
retrieving revision 1.1460
diff -u -b -r1.1459 -r1.1460
--- distrib/ChangeLog   15 Aug 2010 15:03:20 -0000      1.1459
+++ distrib/ChangeLog   15 Aug 2010 15:05:18 -0000      1.1460
@@ -15,6 +15,8 @@
 =========
 
 2010/08/15
+7280: BT: fix make_torrent creates sometimes torrents without name argument
+      (ygrek)
 7278: configure: more useful --enable-debug (ygrek)
 - enable also for ocamlopt
 - enable when profiling 

Index: src/networks/bittorrent/bTTorrent.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTTorrent.ml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- src/networks/bittorrent/bTTorrent.ml        23 May 2010 09:12:14 -0000      
1.21
+++ src/networks/bittorrent/bTTorrent.ml        15 Aug 2010 15:05:18 -0000      
1.22
@@ -387,7 +387,7 @@
 
 let make_torrent announce filename comment is_private =
   let announce_list = [ announce ] in
-  let basename = Filename.basename filename in
+  let basename = Filename2.basename filename in
   let files, t =
     if Unix2.is_directory filename then
       let rec iter_directory list dirname =

Index: src/utils/lib/unix32.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/unix32.ml,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- src/utils/lib/unix32.ml     31 Mar 2008 07:58:17 -0000      1.74
+++ src/utils/lib/unix32.ml     15 Aug 2010 15:05:18 -0000      1.75
@@ -433,7 +433,7 @@
 
     let rec make_tree files =
       match files with
-        [||] -> assert false
+      | [||] -> failwith "make_tree: no files"
       | [| file |] -> Leaf file
       | _ ->
           let len = Array.length files in

Index: tools/make_torrent.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/tools/make_torrent.ml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- tools/make_torrent.ml       25 Oct 2006 11:34:46 -0000      1.9
+++ tools/make_torrent.ml       15 Aug 2010 15:05:19 -0000      1.10
@@ -69,7 +69,7 @@
         let torrent_id, encoded =  BTTorrent.encode_torrent torrent in
         let s = Bencode.encode encoded in
         File.from_string !torrent_filename s;
-        Printf.printf "Torrent file of %s modified\n" (Sha1.to_string 
torrent_id);
+        Printf.printf "Torrent file of %s modified\n" (Sha1.to_hexa 
torrent_id);
     ), ": change the tracker inside a .torrent file";
 
     "-print", Arg.Unit (fun filename ->
@@ -89,7 +89,7 @@
         Printf.printf "        piece size: %Ld\n" torrent.torrent_piece_size;
         Printf.printf "  Pieces: %d\n" (Array.length torrent.torrent_pieces);
         Array.iteri (fun i s ->
-            Printf.printf "    %3d: %s\n" i (Sha1.to_string s)
+            Printf.printf "    %3d: %s\n" i (Sha1.to_hexa s)
         ) torrent.torrent_pieces;
         if torrent.torrent_files <> [] then begin
             Printf.printf "  Files: %d\n" (List.length torrent.torrent_files);
@@ -102,9 +102,13 @@
     "-create", Arg.String (fun filename ->
         check_tracker ();
         check_torrent ();
-        BTTorrent.generate_torrent !announce !torrent_filename !torrent_comment
-          (Int64.of_int !torrent_private) filename;
-        Printf.printf "Torrent file generated\n";
+        try
+          let hash = BTTorrent.generate_torrent !announce !torrent_filename 
!torrent_comment 
+            (Int64.of_int !torrent_private) filename
+          in
+          Printf.printf "Torrent file generated : %s\n" (Sha1.to_hexa hash);
+        with
+          exn -> Printf.printf "Cannot create torrent : %s\n" 
(Printexc2.to_string exn); exit 2
     )," <filename> : compute hashes of filename(s) (can be a directory) and 
generate a .torrent file";
 
     "-split", Arg.String (fun filename ->
@@ -185,8 +189,8 @@
           if torrent.torrent_pieces.(i) <> sha1 then begin
               Printf.printf "WARNING: piece %d (%Ld-%Ld) has SHA1 %s instead 
of %s\n"
                 i begin_pos end_pos
-                (Sha1.to_string sha1)
-              (Sha1.to_string torrent.torrent_pieces.(i));
+                (Sha1.to_hexa sha1)
+              (Sha1.to_hexa torrent.torrent_pieces.(i));
             end
         done;
 



reply via email to

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