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, 17 Jul 2010 10:18:07 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       10/07/17 10:18:07

Modified files:
        distrib        : ChangeLog 
        src/networks/bittorrent: bTInteractive.ml bTMain.ml bTOptions.ml 
                                 bTTracker.ml 

Log message:
        patch #7247

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1442&r2=1.1443
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.156&r2=1.157
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTMain.ml?cvsroot=mldonkey&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTOptions.ml?cvsroot=mldonkey&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTTracker.ml?cvsroot=mldonkey&r1=1.33&r2=1.34

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1442
retrieving revision 1.1443
diff -u -b -r1.1442 -r1.1443
--- distrib/ChangeLog   16 Jul 2010 13:58:39 -0000      1.1442
+++ distrib/ChangeLog   17 Jul 2010 10:18:07 -0000      1.1443
@@ -14,6 +14,9 @@
 ChangeLog
 =========
 
+2010/07/17
+7247: BT tracker: remember tracked files after restart (ygrek)
+
 2010/07/16
 7245: HTML: Fix unstable option sections links position (ygrek)
 7210: upload scheduler: correctly handle clock jumps (ygrek)

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -b -r1.156 -r1.157
--- src/networks/bittorrent/bTInteractive.ml    15 Jul 2010 18:22:05 -0000      
1.156
+++ src/networks/bittorrent/bTInteractive.ml    17 Jul 2010 10:18:07 -0000      
1.157
@@ -1117,7 +1117,7 @@
       | exn -> [text "Error: %s" (Printexc2.to_string exn); `Break]
       end;
       ""
-    ), _s "<filename> <comment> :\tgenerate the corresponding <filename> 
.torrent file with <comment> in torrents/tracked/.\n\t\t\t\t\tThe file is 
automatically tracked, and seeded if in incoming/";
+    ), _s "<filename> [<comment>] :\tgenerate the corresponding <filename> 
.torrent file with <comment>.\n\t\t\t\t\t\tThe file is automatically tracked if 
tracker is enabled and seeded if located in incoming/";
 
     "torrents", "Network/Bittorrent", Arg_none (fun o ->
       output o 

Index: src/networks/bittorrent/bTMain.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTMain.ml,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- src/networks/bittorrent/bTMain.ml   15 Jul 2010 18:22:05 -0000      1.31
+++ src/networks/bittorrent/bTMain.ml   17 Jul 2010 10:18:07 -0000      1.32
@@ -72,7 +72,7 @@
         Pervasives.exit 69
       end;
     if !!BTTracker.tracker_port > 0 then (
-        try BTTracker.start_tracker ()
+        try BTTracker.start_tracker !!tracked_files_list
         with e ->
             lprintf "Exception in BTTracker.start_tracker: %s\n"
               (Printexc2.to_string e));

Index: src/networks/bittorrent/bTOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTOptions.ml,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- src/networks/bittorrent/bTOptions.ml        4 Apr 2010 09:16:28 -0000       
1.42
+++ src/networks/bittorrent/bTOptions.ml        17 Jul 2010 10:18:07 -0000      
1.43
@@ -155,7 +155,12 @@
   ""
     (list_option (tuple2_option (string_option, int64_option))) []
 
+let tracked_files_list = define_option bittorrent_section ["tracked_files"]
+  ""
+    (list_option Sha1.option) []
+
 let get_user_agent () = 
   if !!user_agent = "default" then
     CommonOptions.get_user_agent ()
   else !!user_agent
+

Index: src/networks/bittorrent/bTTracker.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTTracker.ml,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- src/networks/bittorrent/bTTracker.ml        24 May 2010 18:08:17 -0000      
1.33
+++ src/networks/bittorrent/bTTracker.ml        17 Jul 2010 10:18:07 -0000      
1.34
@@ -49,12 +49,11 @@
 
 (*
 
-torrents/: for BitTorrent
-  downloads/: .torrent files of current downloads
-  tracked/: .torrent files of tracked downloads
-    * If the file appears in incoming/, it is automatically seeded.
-  seeded/:
-     * If the file appears in incoming/, it is automatically seeded.
+torrents/: .torrent files
+  downloads/: current downloads
+  seeded/: currently seeding
+  incoming/: monitored for new torrents to start downloading
+  old/: no content available
 
   *)
 
@@ -101,15 +100,15 @@
     port_option 6881
 
 let max_tracked_files = define_option bittorrent_section ["max_tracked_files"]
-  "The maximal number of tracked files (to prevend saturation attack)"
+  "The maximum number of tracked files (to prevent saturation attack)"
     int_option 100
 
 let max_tracker_reply = define_option bittorrent_section ["max_tracker_reply"]
-  "The maximal number of peers returned by the tracker"
+  "The maximum number of peers returned by the tracker"
     int_option 20
 
 let tracker_force_local_torrents = define_option bittorrent_section 
["tracker_force_local_torrents"]
-  "The tracker will check the torrent file is available if an announce request 
is received"
+  "The tracker will track only torrents available locally"
     bool_option true
 
 let tracker_use_key = define_option bittorrent_section ["tracker_use_key"]
@@ -165,6 +164,8 @@
     if !verbose_msg_servers then
       lprintf_nl "Start tracking torrent [%s]" (Sha1.to_hexa info_hash);
     Hashtbl.add tracked_files info_hash tracker;
+    if not (List.mem info_hash !!tracked_files_list) then
+      tracked_files_list =:= info_hash :: !!tracked_files_list;
     tracker
   else
     failwith (Printf.sprintf "[BT] Too many tracked files (%d)" 
!ntracked_files)
@@ -583,7 +584,7 @@
   ) filenames
     *)
 
-let start_tracker () =
+let start_tracker tracked =
   if !!tracker_port <> 0 then begin
       let config = {
           bind_addr = if !!force_client_ip then Ip.to_inet_addr 
!!set_client_ip else Unix.inet_addr_any ;
@@ -598,7 +599,13 @@
       let sock = TcpServerSocket.create "BT tracker"
           (Ip.to_inet_addr !!client_bind_addr)
         !!tracker_port (Http_server.handler config) in
-      tracker_sock := Some sock
+      tracker_sock := Some sock;
+      List.iter begin fun info_hash ->
+        try
+          ignore (new_tracker info_hash)
+        with exn ->
+          lprintf_nl "Cannot start tracking %s : %s" (Sha1.to_hexa info_hash) 
(Printexc2.to_string exn)
+      end tracked
     end
 (*
   if !!tracker_port <> 0 then begin



reply via email to

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