mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distribChangeLog src/daemon/driver/dri...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distribChangeLog src/daemon/driver/dri...
Date: Tue, 27 Jun 2006 20:25:51 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/06/27 20:25:51

Modified files:
        distrib        : ChangeLog 
        src/daemon/driver: driverInterface.ml 
        src/networks/bittorrent: bTInteractive.ml 

Log message:
        patch #5200

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.904&r2=1.905
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverInterface.ml?cvsroot=mldonkey&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.97&r2=1.98

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.904
retrieving revision 1.905
diff -u -b -r1.904 -r1.905
--- distrib/ChangeLog   27 Jun 2006 10:42:32 -0000      1.904
+++ distrib/ChangeLog   27 Jun 2006 20:25:50 -0000      1.905
@@ -15,6 +15,9 @@
 =========
 
 2006/06/27
+5200: BT: Do not start downloads if no usable trackers are found in 
file.torrent
+      MLDonkey only supports http:// style trackers, not udp:// or dht://
+      Deactivated http:// trackers are better marked in HTML,vd #num
 5202: Remove mlchat and outdated IM (instant messenger) code
       Remove outdated files from ./packages/windows
 5204: Cleanup longhelp (anhi)

Index: src/daemon/driver/driverInterface.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInterface.ml,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- src/daemon/driver/driverInterface.ml        18 Jun 2006 20:24:21 -0000      
1.48
+++ src/daemon/driver/driverInterface.ml        27 Jun 2006 20:25:51 -0000      
1.49
@@ -1112,9 +1112,12 @@
     Failure s ->
       gui_send gui (Console (Printf.sprintf "Failure: %s\n" s))
   | e ->
-      gui_send gui (Console (    
-          Printf.sprintf "from_gui: exception %s for message %s\n" (
-            Printexc2.to_string e) (GuiProto.string_of_from_gui t)))
+      let error_text = Printexc2.to_string e in
+      if error_text = "BTInteractive.Torrent_can_not_be_used" then
+       gui_send gui (Console (Printf.sprintf "\nError: This torrent does not 
have valid tracker URLs\n"))
+      else
+       gui_send gui (Console (Printf.sprintf "from_gui: exception %s for 
message %s\n"
+          (Printexc2.to_string e) (GuiProto.string_of_from_gui t)))
 
 let gui_events () = 
   {

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- src/networks/bittorrent/bTInteractive.ml    27 Jun 2006 10:26:48 -0000      
1.97
+++ src/networks/bittorrent/bTInteractive.ml    27 Jun 2006 20:25:51 -0000      
1.98
@@ -53,6 +53,7 @@
 module VB = VerificationBitmap
 
 exception Already_exists
+exception Torrent_can_not_be_used
 
 let op_file_all_sources file =
   let list = ref [] in
@@ -145,12 +146,15 @@
   html_mods_td buf [
     ("Tracker(s)", "sr br", "Tracker(s)");
     ("", "sr",
-      (let tracker_string = ref "" in
+      (let enabled_tracker_string = ref "" in
+       let disabled_tracker_string = ref "" in
        List.iter (fun tracker ->
-         tracker_string := (if tracker.tracker_enabled then "" else "*") ^ 
-          !tracker_string ^ (shorten tracker.tracker_url !!max_name_len) ^ " "
+        if tracker.tracker_enabled then
+          enabled_tracker_string := !enabled_tracker_string ^ (shorten 
tracker.tracker_url !!max_name_len) ^ " "
+        else
+          disabled_tracker_string := !disabled_tracker_string ^ (shorten 
tracker.tracker_url !!max_name_len) ^ " "
       ) file.file_trackers;
-      !tracker_string)) ];
+      (!enabled_tracker_string ^ (if !disabled_tracker_string <> "" then " - 
disabled: " ^ !disabled_tracker_string else "")))) ];
 
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
 
@@ -475,6 +479,13 @@
 
   (* Save the torrent, because we later want to put
      it in the seeded directory. *)
+  let torrent_is_usable = ref false in
+  let can_handle_tracker url =
+    String2.check_prefix url "http://"; in
+  List.iter (fun url -> if can_handle_tracker url then torrent_is_usable := 
true)
+    (if torrent.torrent_announce_list <> [] then torrent.torrent_announce_list 
else [torrent.torrent_announce]);
+  if not !torrent_is_usable then raise Torrent_can_not_be_used;
+
   let torrent_diskname = Filename.concat
     downloads_directory
     torrent.torrent_name ^ ".torrent"
@@ -627,11 +638,16 @@
   let filenames = Unix2.list_directory new_torrents_directory in
   List.iter (fun file ->
     let file = Filename.concat new_torrents_directory file in
+    let file_basename = Filename.basename file in
     if not (Unix2.is_directory file) then
     try
       load_torrent_file file;
       (try Sys.remove file with _ -> ())
-    with e -> lprintf_nl "Error %s in scan_new_torrents_directory" 
(Printexc2.to_string e)
+    with 
+      Torrent_can_not_be_used ->
+       Unix2.rename file (Filename.concat old_directory file_basename);
+       lprintf_nl "Torrent %s does not have valid tracker URLs, moved to 
torrents/old ..." file_basename
+    | e -> lprintf_nl "Error %s in scan_new_torrents_directory for %s" 
(Printexc2.to_string e) file_basename
   ) filenames
 
 let retry_all_ft () =
@@ -718,7 +734,9 @@
           try
             load_torrent_file url;
             "", true
-          with Already_exists -> "A torrent with this name is already in the 
download queue", false
+          with
+           Already_exists -> "A torrent with this name is already in the 
download queue", false
+         | Torrent_can_not_be_used -> "This torrent does not have valid 
tracker URLs", false
         with e ->
           lprintf_nl "Exception %s while 2nd loading" (Printexc2.to_string e);
          let s = Printf.sprintf "Can not load load torrent file: %s"




reply via email to

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