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: Tue, 12 Sep 2006 22:44:52 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/09/12 22:44:52

Modified files:
        distrib        : ChangeLog 
        src/networks/bittorrent: bTGlobals.ml bTTypes.ml 

Log message:
        patch #5383

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.998&r2=1.999
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTGlobals.ml?cvsroot=mldonkey&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTTypes.ml?cvsroot=mldonkey&r1=1.35&r2=1.36

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.998
retrieving revision 1.999
diff -u -b -r1.998 -r1.999
--- distrib/ChangeLog   12 Sep 2006 22:44:09 -0000      1.998
+++ distrib/ChangeLog   12 Sep 2006 22:44:52 -0000      1.999
@@ -15,6 +15,12 @@
 =========
 
 2006/09/13
+5383: BT: Detect new client types (thx to pango)
+- fix Mainline detection for two-digit version numbers
+- fix Tornado detection
+- fix broken Bits on wheels detection
+- detect Rufus
+- detect Bitspirit v3
 5384: BT: Fix serious bug causing bad performance introduced
       by abstract bitmaps patch (pango)
 

Index: src/networks/bittorrent/bTGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTGlobals.ml,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- src/networks/bittorrent/bTGlobals.ml        8 Aug 2006 23:55:28 -0000       
1.61
+++ src/networks/bittorrent/bTGlobals.ml        12 Sep 2006 22:44:52 -0000      
1.62
@@ -359,10 +359,29 @@
   List.iter (fun i -> Buffer.add_char buf s.[i]) l;
   dot_string (Buffer.contents buf)
 
+let dot_string_of_string s =
+  let buf = Buffer.create 20 in
+  let found_non_int = ref false in
+  String.iter (fun s ->
+    match s with
+    | '0' .. '9' ->
+       if !found_non_int then Buffer.add_char buf '.';
+       found_non_int := false;
+       Buffer.add_char buf s
+    | _ -> found_non_int := true
+  ) s;
+  Buffer.contents buf
+
 let check_all s c l =
   let ch = char_of_int c in
   List.for_all (fun i -> s.[i] = ch) l
 
+let check_int s p =
+  try
+    ignore (int_of_string (String.sub s p 1));
+    true
+  with _ -> false
+
 (* from azureus/gpl *)
 let decode_az_style s =
   if check_all s 45 [0;7] then begin
@@ -419,7 +438,7 @@
   None
 
 let decode_tornado_style s =
-  if check_all s 45 [4;5] then begin
+  if check_all s 45 [5] then begin
     let check_brand s =
      match s with
      | "T" -> Brand_bittornado
@@ -447,7 +466,7 @@
   None
 
 let decode_mainline_style s =
-  if check_all s 45 [2;4;6;7] then begin
+  if check_all s 45 [2;7] && check_int s 1 then begin
     let s_id = String.sub s 0 1 in
     let brand =
       match s_id with
@@ -455,7 +474,7 @@
      | _ -> Brand_unknown
     in
     if brand = Brand_unknown then None
-    else Some (brand, (dot_string_of_list s [1;3;5]))
+    else Some (brand, (dot_string_of_string (String.sub s 1 6)))
   end else
   None
 
@@ -508,9 +527,17 @@
      Some (Brand_opera, (dot_string_of_list s [2;3;4;5]))
   else None
 
+let decode_rufus s =
+  let release s =
+    let minor = Char.code s.[1] in
+    Printf.sprintf "%d.%d.%d" (Char.code s.[0]) (minor / 10) (minor mod 10) in
+  if "RS" = String.sub s 2 2 then
+     Some (Brand_rufus, release s)
+  else None
+
 let decode_bow s =
   if "BOW" = String.sub s 0 3 ||
-  (check_all s 45 [0;7] && "BOW" = String.sub s 1 4) then
+  (check_all s 45 [0;7] && "BOW" = String.sub s 1 3) then
     Some (Brand_bitsonwheels, (String.sub s 4 3))
   else None
 
@@ -554,6 +581,7 @@
     let bv = ref None in
     if s.[1] = (char_of_int 0) then bv := Some (Brand_bitspirit, "v1");
     if s.[1] = (char_of_int 2) then bv := Some (Brand_bitspirit, "v2");
+    if s.[1] = (char_of_int 3) then bv := Some (Brand_bitspirit, "v3");
     !bv
   end else
   None
@@ -659,6 +687,7 @@
     decode_non_zero;
     decode_mldonkey_style;
     decode_opera;
+    decode_rufus;
   ]
 
 let parse_software s = 

Index: src/networks/bittorrent/bTTypes.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTTypes.ml,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- src/networks/bittorrent/bTTypes.ml  8 Aug 2006 23:55:28 -0000       1.35
+++ src/networks/bittorrent/bTTypes.ml  12 Sep 2006 22:44:52 -0000      1.36
@@ -103,6 +103,7 @@
 | Brand_jvtorrent
 | Brand_retriever
 | Brand_osprey
+| Brand_rufus
 
 let brand_list = [ 
    ( Brand_unknown          , "unknown"                , "unk" ) ;
@@ -161,6 +162,7 @@
    ( Brand_jvtorrent        , "JVtorrent"              , "jvt" ) ;
    ( Brand_retriever        , "Retriever"              , "ret" ) ;
    ( Brand_osprey           , "Osprey permaseed"       , "osp" ) ;
+   ( Brand_rufus            , "Rufus"                  , "ruf" ) ;
   ] 
 
 let brand_count = List.length brand_list




reply via email to

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