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/donkey/...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...
Date: Tue, 28 Nov 2006 23:50:34 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/11/28 23:50:34

Modified files:
        distrib        : ChangeLog 
        src/networks/donkey: donkeyClient.ml donkeyProtoClient.ml 
                             donkeyProtoServer.ml donkeyTypes.ml 

Log message:
        patch #5595

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1119&r2=1.1120
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyClient.ml?cvsroot=mldonkey&r1=1.111&r2=1.112
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoClient.ml?cvsroot=mldonkey&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoServer.ml?cvsroot=mldonkey&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyTypes.ml?cvsroot=mldonkey&r1=1.52&r2=1.53

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1119
retrieving revision 1.1120
diff -u -b -r1.1119 -r1.1120
--- distrib/ChangeLog   28 Nov 2006 23:42:28 -0000      1.1119
+++ distrib/ChangeLog   28 Nov 2006 23:50:33 -0000      1.1120
@@ -15,6 +15,7 @@
 =========
 
 2006/11/29
+5595: EDK: Fully parse emule_miscoptions1/2
 5594: EDK: If update_server_list_client true, add yet unknown server
       of lowid clients
 

Index: src/networks/donkey/donkeyClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- src/networks/donkey/donkeyClient.ml 28 Nov 2006 23:42:28 -0000      1.111
+++ src/networks/donkey/donkeyClient.ml 28 Nov 2006 23:50:33 -0000      1.112
@@ -664,10 +664,17 @@
    iter 0 (Array.length mod_array)
 
 let update_client_from_tags c tags =
+  let module M = DonkeyProtoClient in
   List.iter (fun tag ->
       match tag.tag_name with
-      | Field_UNKNOWN "name" -> ()
-      | Field_UNKNOWN "version" -> ()
+      | Field_UNKNOWN "name"
+      | Field_UNKNOWN "port"
+      | Field_UNKNOWN "version"
+      | Field_UNKNOWN "buddy_ip"
+      | Field_UNKNOWN "buddy_udp"
+      | Field_UNKNOWN "mod_plus"
+      | Field_UNKNOWN "l2hac"
+      | Field_UNKNOWN "udpport" -> ()
       | Field_UNKNOWN "emule_udpports" -> 
           for_two_int16_tag tag (fun ed2k_port kad_port ->
 (* Kademlia: we should use this client to bootstrap Kademlia *)
@@ -677,17 +684,25 @@
           )
       | Field_UNKNOWN "emule_miscoptions1" ->
           for_int64_tag tag (fun i ->
-            DonkeyProtoClient.update_emule_proto_from_miscoptions1
-            c.client_emule_proto i
+            M.update_emule_proto_from_miscoptions1
+            c.client_emule_proto i;
+            if !verbose_msg_clients || c.client_debug then
+              lprintf_nl "miscoptions1 from client %s\n%s"
+                (full_client_identifier c)
+                (M.print_emule_proto_miscoptions1 c.client_emule_proto)
           )
       | Field_UNKNOWN "emule_miscoptions2" ->
           for_int64_tag tag (fun i ->
-            DonkeyProtoClient.update_emule_proto_from_miscoptions2
-            c.client_emule_proto i
+            M.update_emule_proto_from_miscoptions2
+            c.client_emule_proto i;
+            if !verbose_msg_clients || c.client_debug then
+              lprintf_nl "miscoptions2 from client %s\n%s"
+                (full_client_identifier c)
+                (M.print_emule_proto_miscoptions2 c.client_emule_proto)
           )
       | Field_UNKNOWN "emule_compatoptions" ->
           for_int_tag tag (fun i ->
-            DonkeyProtoClient.update_emule_proto_from_compatoptions
+            M.update_emule_proto_from_compatoptions
             c.client_emule_proto i
           )
       | Field_UNKNOWN "emule_version" ->
@@ -704,8 +719,7 @@
           let s = to_lowercase (string_of_tag_value tag.tag_value) in 
           parse_mod_version s c
       | _ -> 
-          if !verbose_msg_clienttags then
-            lprintf_nl "Unknown Emule tag: [%s] (update_client_from_tags)" 
(escaped_string_of_field tag)
+            lprintf_nl "update_client_from_tags, unknown tag: [%s] (%s)" 
(string_of_tag tag) (full_client_identifier c)
   ) tags
     
 let update_emule_proto_from_tags c tags =
@@ -725,7 +739,6 @@
           for_int_tag tag (fun i ->
             c.client_emule_proto.emule_udpver <- i
           )
-      | Field_UNKNOWN "udpport" -> ()
       | Field_UNKNOWN "sourceexchange" ->
           for_int_tag tag (fun i ->
             c.client_emule_proto.emule_sourceexchange <- i
@@ -743,17 +756,18 @@
             c.client_emule_proto.emule_secident <- i land 0x3
           )
       | Field_UNKNOWN "mod_version" ->
-          let s = to_lowercase (string_of_tag_value tag.tag_value) in 
-          parse_mod_version s c;
+          parse_mod_version (to_lowercase (string_of_tag_value tag.tag_value)) 
c;
 
       | Field_UNKNOWN "os_info" ->
           let s = to_lowercase (string_of_tag_value tag.tag_value) in 
          (match c.client_osinfo with
            Some _ -> ()
          | _ ->  if s <> "" then c.client_osinfo <- Some s)
+      | Field_UNKNOWN "udpport"
+      | Field_UNKNOWN "mod_plus"
+      | Field_UNKNOWN "l2hac" -> ()
       | _ -> 
-          if !verbose_msg_clienttags then
-            lprintf_nl "Unknown Emule tag: [%s] 
(update_emule_proto_from_tags)" (escaped_string_of_field tag)
+            lprintf_nl "update_emule_proto_from_tags, unknown tag: [%s] (%s)" 
(string_of_tag tag) (full_client_identifier c)
   ) tags
 
 let fight_disguised_mods c =

Index: src/networks/donkey/donkeyProtoClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoClient.ml,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- src/networks/donkey/donkeyProtoClient.ml    26 Nov 2006 16:36:29 -0000      
1.40
+++ src/networks/donkey/donkeyProtoClient.ml    28 Nov 2006 23:50:33 -0000      
1.41
@@ -39,67 +39,111 @@
     (int_of_string(Autoconf.minor_version) lsl 10) lor
     (int_of_string(Autoconf.sub_version) lsl 7)
 
-(* TODO : update this
-I downgraded some of those to get better results :
-We don't use emule udp extension, client_md4 in sourceexchange or complete 
sources in
-file request *)
 let mldonkey_emule_proto = 
   {
-    emule_comments = 1;
     emule_version = get_emule_version (); 
     emule_release = "";
-    emule_secident = 3; (* Emule uses v1 if advertising both, v2 if only 
advertising 2 *)
-    emule_noviewshared = 0;
-    emule_supportpreview = 0;
     emule_osinfosupport = 1;
-    emule_compression = 1; (* 1 *)
+    emule_features = 3;
+
+(* emule_miscoptions1 *)
+    emule_aich = 0;
+    emule_unicode = 0;
+    emule_udpver = 0;
+    emule_compression = 1;
+    emule_secident = 3; (* Emule uses v1 if advertising both, v2 if only 
advertising 2 *)
     emule_sourceexchange = 2; (* 2 : +client_md4 3 : +IdHybrid (emule 
Kademlia?)*)
-    emule_multipacket = 0; (* 1 *)
     emule_extendedrequest = 1; (* 1: +file_status 2: +ncomplete_sources*)
-    emule_features = 3; (* 3 *)
-    emule_udpver = 0; (* 4 *)
+    emule_comments = 1;
+    emule_peercache = 0;
+    emule_noviewshared = 0;
+    emule_multipacket = 0;
+    emule_supportpreview = 0;
+
+(* emule_miscoptions2 *)
+    emule_require_crypt = 0;
+    emule_request_crypt = 0;
+    emule_support_crypt = 0;
+    emule_extmultipacket = 0;
+    emule_largefiles = 0;
+    emule_kad_version = 0;
   }
 
 let emule_miscoptions1 m =
   let o =
+    (m.emule_aich lsl 29) lor
+    (m.emule_unicode lsl 28) lor
     (m.emule_udpver lsl 24) lor
     (m.emule_compression lsl 20) lor
     (m.emule_secident lsl 16) lor
     (m.emule_sourceexchange lsl 12) lor
     (m.emule_extendedrequest lsl 8) lor
     (m.emule_comments lsl 4) lor
+    (m.emule_peercache lsl 3) lor
     (m.emule_noviewshared lsl 2) lor
     (m.emule_multipacket lsl 1) lor
     (m.emule_supportpreview lsl 0)
   in
   Int64.of_int o
 
-let emule_miscoptions2 m =
-(*
-  let o =
-    (m.emule_largefiles lsl 4)
-  in
-  Int64.of_int o
-*)
-  Int64.zero
-
 let update_emule_proto_from_miscoptions1 m o =
   let o = Int64.to_int o in
+  m.emule_aich            <- (o lsr 29) land 0x7;
+  m.emule_unicode         <- (o lsr 28) land 0xf;
   m.emule_udpver <- (o lsr 24) land 0xf;
   m.emule_compression <- (o lsr 20) land 0xf;
   m.emule_secident <- (o lsr 16) land 0xf;
   m.emule_sourceexchange <- (o lsr 12) land 0xf;
   m.emule_extendedrequest <- (o lsr 8) land 0xf;
   m.emule_comments <- (o lsr 4) land 0xf;
+  m.emule_peercache       <- (o lsr  3) land 0x1;
   m.emule_noviewshared <- (o lsr 2) land 0x1;
   m.emule_multipacket <- (o lsr 1) land 0x1;
   m.emule_supportpreview <- (o lsr 0) land 0x1
 
-let update_emule_proto_from_miscoptions2 m o = ()
+let print_emule_proto_miscoptions1 m =
+  let buf = Buffer.create 50 in
+  if m.emule_aich <> 0 then Printf.bprintf buf " aich %d\n" m.emule_aich;
+  if m.emule_unicode <> 0 then Printf.bprintf buf " unicode %d\n" 
m.emule_unicode;
+  if m.emule_udpver <> 0 then Printf.bprintf buf " udpver %d\n" m.emule_udpver;
+  if m.emule_compression <> 0 then Printf.bprintf buf " compression %d\n" 
m.emule_compression;
+  if m.emule_secident <> 0 then Printf.bprintf buf " secident %d\n" 
m.emule_secident;
+  if m.emule_sourceexchange <> 0 then Printf.bprintf buf " sourceexchange 
%d\n" m.emule_sourceexchange;
+  if m.emule_extendedrequest <> 0 then Printf.bprintf buf " extendedrequest 
%d\n" m.emule_extendedrequest;
+  if m.emule_comments <> 0 then Printf.bprintf buf " comments %d\n" 
m.emule_comments;
+  if m.emule_peercache <> 0 then Printf.bprintf buf " peercache %d\n" 
m.emule_peercache;
+  if m.emule_noviewshared <> 0 then Printf.bprintf buf " noviewshared %d\n" 
m.emule_noviewshared;
+  if m.emule_multipacket <> 0 then Printf.bprintf buf " multipacket %d\n" 
m.emule_multipacket;
+  if m.emule_supportpreview <> 0 then Printf.bprintf buf " supportpreview 
%d\n" m.emule_supportpreview;
+  Buffer.contents buf
+
+let emule_miscoptions2 m =
 (*
-  let o = Int64.to_int o in
-  m.emule_largefiles <- (o lsr 4) land 0x1
+  let o =
+    (m.emule_largefiles lsl 4)
+  in
+  Int64.of_int o
 *)
+  Int64.zero
+
+let update_emule_proto_from_miscoptions2 m o =
+  let o = Int64.to_int o in
+  m.emule_require_crypt  <- (o lsr 9) land 0x1;
+  m.emule_request_crypt  <- (o lsr 8) land 0x1;
+  m.emule_support_crypt  <- (o lsr 7) land 0x1;
+  m.emule_extmultipacket <- (o lsr 5) land 0x1;
+  m.emule_largefiles     <- (o lsr 4) land 0x1;
+  m.emule_kad_version    <- (o lsr 0) land 0xf
+
+let print_emule_proto_miscoptions2 m =
+  let buf = Buffer.create 50 in
+  if m.emule_require_crypt <> 0 then Printf.bprintf buf " require_crypt %d\n" 
m.emule_require_crypt;
+  if m.emule_request_crypt <> 0 then Printf.bprintf buf " request_crypt %d\n" 
m.emule_request_crypt;
+  if m.emule_support_crypt <> 0 then Printf.bprintf buf " support_crypt %d\n" 
m.emule_support_crypt;
+  if m.emule_extmultipacket <> 0 then Printf.bprintf buf " extmultipacket 
%d\n" m.emule_extmultipacket;
+  if m.emule_largefiles <> 0 then Printf.bprintf buf " largefiles %d\n" 
m.emule_largefiles;
+  if m.emule_kad_version <> 0 then Printf.bprintf buf " kad_version %d\n" 
m.emule_kad_version;
+  Buffer.contents buf
 
 let emule_compatoptions m =
   (m.emule_osinfosupport lsl 0)

Index: src/networks/donkey/donkeyProtoServer.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoServer.ml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- src/networks/donkey/donkeyProtoServer.ml    26 Nov 2006 16:36:29 -0000      
1.23
+++ src/networks/donkey/donkeyProtoServer.ml    28 Nov 2006 23:50:33 -0000      
1.24
@@ -28,31 +28,6 @@
 open DonkeyTypes
 open DonkeyMftp
 
-(*
-let field_of_tagname s =
-  match s with
-  | "size" -> Field_Size
-  | "filename" -> Field_Filename
-  | "Artist" -> Field_Artist
-  | "Album" -> Field_Album
-  | "Title" -> Field_Title
-  | "format" -> Field_Format
-  | "type" -> Field_Type
-  | s -> Field_UNKNOWN s
-
-let tagname_of_field field =
-  match field with
-    Field_Size -> "size"
-  | Field_Filename -> "filename"
-  | Field_Artist -> "Artist"
-  | Field_Album -> "Album"
-  | Field_Title -> "Title"
-  | Field_Format -> "format"
-  | Field_Type -> "type"
-  | Field_Uid -> "uid"
-  | Field_unknown s -> s
-*)
-
 module Connect = struct
     type t = {
         md4 : Md4.t;

Index: src/networks/donkey/donkeyTypes.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyTypes.ml,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- src/networks/donkey/donkeyTypes.ml  26 Nov 2006 16:36:29 -0000      1.52
+++ src/networks/donkey/donkeyTypes.ml  28 Nov 2006 23:50:33 -0000      1.53
@@ -33,20 +33,32 @@
   lprintf2 log_prefix fmt
 
 type emule_proto = {
-    mutable emule_comments : int;
     mutable emule_version : int;
     mutable emule_release : string;
-    mutable emule_secident : int;
-    mutable emule_noviewshared : int;
-    mutable emule_supportpreview : int;
     mutable emule_osinfosupport : int;
+    mutable emule_features : int;
 
+(* emule_miscoptions1 *)
+    mutable emule_aich : int;
+    mutable emule_unicode : int;
+    mutable emule_udpver : int;
     mutable emule_compression : int;
+    mutable emule_secident : int;
     mutable emule_sourceexchange : int;
-    mutable emule_multipacket : int;
     mutable emule_extendedrequest : int;
-    mutable emule_features : int;
-    mutable emule_udpver : int;
+    mutable emule_comments : int;
+    mutable emule_peercache : int;
+    mutable emule_noviewshared : int;
+    mutable emule_multipacket : int;
+    mutable emule_supportpreview : int;
+
+(* emule_miscoptions2 *)
+    mutable emule_require_crypt : int;
+    mutable emule_request_crypt : int;
+    mutable emule_support_crypt : int;
+    mutable emule_extmultipacket : int;
+    mutable emule_largefiles : int;
+    mutable emule_kad_version : int;
   }
 
 type emule_tag_name =
@@ -688,20 +700,32 @@
   CommonServer.server_state (as_server server.server_server)
 
 let dummy_emule_proto = {
-    emule_comments = 0;
     emule_version = 0;
     emule_release = "";
-    emule_secident = 0;
-    emule_noviewshared = 0;
-    emule_supportpreview = 0;
     emule_osinfosupport = 0;
+    emule_features = 0;
 
+(* emule_miscoptions1 *)
+    emule_aich = 0;
+    emule_unicode = 0;
+    emule_udpver = 0;
     emule_compression = 0; (* 1 *)
+    emule_secident = 0;
     emule_sourceexchange = 0; (* 3 *)
-    emule_multipacket = 0; (* 1 *)
     emule_extendedrequest = 0; (* 2 *)
-    emule_features = 0; (* 3 *)
-    emule_udpver = 0; (* 4 *)
+    emule_comments = 0;
+    emule_peercache = 0;
+    emule_noviewshared = 0;
+    emule_multipacket = 0;
+    emule_supportpreview = 0;
+
+(* emule_miscoptions2 *)
+    emule_require_crypt = 0;
+    emule_request_crypt = 0;
+    emule_support_crypt = 0;
+    emule_extmultipacket = 0;
+    emule_largefiles = 0;
+    emule_kad_version = 0;
   }
 
 let emule_proto () =




reply via email to

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