mldonkey-users
[Top][All Lists]
Advanced

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

Re: [Mldonkey-users] Low or high ID?


From: Pierre Etchemaite
Subject: Re: [Mldonkey-users] Low or high ID?
Date: Mon, 28 Oct 2002 13:42:43 +0100

Le Thu, 24 Oct 2002 14:16:58 +0200, Rainer Krauss <address@hidden> a
écrit :

> But if i get a connection the number looks like that. This number is
> greater than 400.000.000! What is it?
> HighIDs should be IPs, lowIDs should be numbers but far less than this
> one.

I guess mldonkey forgot to reverse the quad bytes before displaying the
LowID; Here's a totally untested patch:

--- donkey/donkeyInteractive.ml 14 Oct 2002 22:21:48 -0000      1.16
+++ donkey/donkeyInteractive.ml 28 Oct 2002 12:39:20 -0000
@@ -540,8 +540,8 @@
               (Ip.to_string s.server_ip) s.server_port
               (if Ip.valid s.server_cid then
                 Ip.to_string s.server_cid
-              else
-                Int32.to_string (Ip.to_int32 s.server_cid))
+             else
+                Int32.to_string (Ip.to_int32 (Ip.rev s.server_cid)))
         ) (connected_servers());
         ""
     ), " : print ID on connected servers";
--- lib/ip.ml   5 Oct 2002 22:09:51 -0000       1.11
+++ lib/ip.ml   28 Oct 2002 12:39:20 -0000
@@ -58,6 +58,9 @@
   let a1 = Int32.to_int (Int32.logand i const_int32_255)
   in
   (a4, a3, a2, a1)
+
+let rev ((a4, a3, a2, a1) as t) =
+  (a1, a2, a3, a4)
   
 let resolve_one t =
   try
--- lib/ip.mli  5 Oct 2002 22:09:51 -0000       1.9
+++ lib/ip.mli  28 Oct 2002 12:39:20 -0000
@@ -25,6 +25,7 @@
 val to_inet_addr : t -> Unix.inet_addr
 val to_string : t -> string
 val to_ints : t -> int * int * int * int
+val rev : t -> t
 
 val to_fixed_string : t -> string
 
@@ -51,4 +52,4 @@
 val equal : t -> t -> bool
 val value_to_ip : Options.option_value -> t
 val ip_to_value : t -> Options.option_value
-  
\ No newline at end of file
+  




reply via email to

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