[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey config/Makefile.in distrib/ChangeLog s...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey config/Makefile.in distrib/ChangeLog s... |
Date: |
Fri, 06 Jan 2006 22:23:09 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Branch:
Changes by: spiralvoice <address@hidden> 06/01/06 22:23:09
Modified files:
config : Makefile.in
distrib : ChangeLog
src/config/unix: os_stubs_c.c
src/daemon/common: commonClient.ml commonOptions.ml
commonTypes.ml guiDecoding.ml guiEncoding.ml
guiProto.ml
src/daemon/driver: driverCommands.ml driverMain.ml
src/networks/bittorrent: bTInteractive.ml
src/networks/donkey: donkeyInteractive.ml
src/networks/fileTP: fileTPInteractive.ml
src/networks/gnutella: gnutellaInteractive.ml
Added files:
src/utils/net : geoip.ml
Log message:
patch #4765
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/config/Makefile.in.diff?tr1=1.140&tr2=1.141&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.659&tr2=1.660&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/config/unix/os_stubs_c.c.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonClient.ml.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonOptions.ml.diff?tr1=1.115&tr2=1.116&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonTypes.ml.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiDecoding.ml.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiEncoding.ml.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiProto.ml.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml.diff?tr1=1.110&tr2=1.111&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverMain.ml.diff?tr1=1.86&tr2=1.87&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml.diff?tr1=1.74&tr2=1.75&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml.diff?tr1=1.79&tr2=1.80&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/fileTP/fileTPInteractive.ml.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella/gnutellaInteractive.ml.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/net/geoip.ml?rev=1.1
Patches:
Index: mldonkey/config/Makefile.in
diff -u mldonkey/config/Makefile.in:1.140 mldonkey/config/Makefile.in:1.141
--- mldonkey/config/Makefile.in:1.140 Wed Jan 4 22:32:42 2006
+++ mldonkey/config/Makefile.in Fri Jan 6 22:23:08 2006
@@ -222,7 +222,7 @@
NET_SRCS = \
$(NET)/basicSocket.ml \
- $(NET)/ip.ml $(NET)/ip_set.ml $(NET)/mailer.ml $(NET)/base64.ml \
+ $(NET)/ip.ml $(NET)/ip_set.ml $(NET)/geoip.ml $(NET)/mailer.ml
$(NET)/base64.ml \
$(NET)/anyEndian.ml $(NET)/bigEndian.ml $(NET)/littleEndian.ml \
$(NET)/tcpBufferedSocket.ml \
$(NET)/tcpServerSocket.ml \
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.659 mldonkey/distrib/ChangeLog:1.660
--- mldonkey/distrib/ChangeLog:1.659 Thu Jan 5 02:03:34 2006
+++ mldonkey/distrib/ChangeLog Fri Jan 6 22:23:08 2006
@@ -11,6 +11,18 @@
To compile MLDonkey on MinGW follow this guide:
http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=Windows
+2006/01/06
+4765: Add GeoIP.dat support (zet)
+ GeoIP is a GPL database that maps IPs to countries.
+ http://www.maxmind.com/download/geoip/database/
+ This patch adds support for a "geoip_dat" option.
+ It is a simple ocaml translation of just the geoip country lookup code.
+ If active, the file is left open and consulted on demand.
+ It didn't seem to slow anything down on my slow system.
+ Sends the country # to the gui, use latest Sancho version to use it.
+ Web: displays country codes in a column (name in tooltip).
+ Maybe someone wants to add flag images (please make them optional).
+-------------------------------------------------------------------------------
2006/01/05: version 2.7.2 = tag release-2-7-2
4764: Patch for MLDonkey-compiled Ocaml-3.09.1 to fix GTK1 oldgui compile
4763: Compile patch for GTK1 oldgui with Ocaml 3.09.1
Index: mldonkey/src/config/unix/os_stubs_c.c
diff -u mldonkey/src/config/unix/os_stubs_c.c:1.13
mldonkey/src/config/unix/os_stubs_c.c:1.14
--- mldonkey/src/config/unix/os_stubs_c.c:1.13 Wed Nov 30 23:46:25 2005
+++ mldonkey/src/config/unix/os_stubs_c.c Fri Jan 6 22:23:08 2006
@@ -78,7 +78,7 @@
write(fd, &zero, 1);
} else
if((cursize != len) && (ftruncate(fd, len) < 0)) {
- fprintf(stderr, "ftruncate(%d,%d)\n", fd, len);
+ fprintf(stderr, "ftruncate(%d,%Ld)\n", fd, len);
uerror("ml_truncate32: error in ftruncate",Nothing);
}
}
@@ -131,7 +131,7 @@
void os_uname(char buf[]) {
struct utsname uts;
uname(&uts);
- sprintf(buf, "%s %s %s %s %s\0",
+ sprintf(buf, "%s %s %s %s %s",
uts.sysname, uts.nodename, uts.release, uts.version, uts.machine);
}
#else
Index: mldonkey/src/daemon/common/commonClient.ml
diff -u mldonkey/src/daemon/common/commonClient.ml:1.22
mldonkey/src/daemon/common/commonClient.ml:1.23
--- mldonkey/src/daemon/common/commonClient.ml:1.22 Sun Dec 18 14:50:38 2005
+++ mldonkey/src/daemon/common/commonClient.ml Fri Jan 6 22:23:08 2006
@@ -419,7 +419,6 @@
let client_print c o =
let impl = as_client_impl c in
- let i = client_info c in
let n = impl.impl_client_ops.op_client_network in
let info = client_info c in
let buf = o.conn_buf in
@@ -438,7 +437,7 @@
n.network_name
(client_num c)
(shorten info.G.client_name 20)
- i.GuiTypes.client_rating
+ info.GuiTypes.client_rating
(match info.G.client_kind with
Indirect_location (name, _) -> "firewalled"
| Known_location (ip, port) ->
Index: mldonkey/src/daemon/common/commonOptions.ml
diff -u mldonkey/src/daemon/common/commonOptions.ml:1.115
mldonkey/src/daemon/common/commonOptions.ml:1.116
--- mldonkey/src/daemon/common/commonOptions.ml:1.115 Wed Jan 4 14:24:00 2006
+++ mldonkey/src/daemon/common/commonOptions.ml Fri Jan 6 22:23:09 2006
@@ -844,6 +844,10 @@
Zip files must contain either a file named guarding.p2p or
guarding_full.p2p."
string_option ""
+let geoip_dat = define_expert_option current_section ["geoip_dat"]
+ "Location of GeoIP.dat (Get one from
http://www.maxmind.com/download/geoip/database/)"
+ string_option ""
+
let _ =
option_hook ip_blocking_descriptions (fun _ ->
Ip_set.store_blocking_descriptions := !!ip_blocking_descriptions
@@ -854,6 +858,11 @@
Ip_set.load !!ip_blocking
else Ip_set.bl_empty
with _ -> ()
+ );
+ option_hook geoip_dat (fun _ ->
+ try
+ Geoip.init !!geoip_dat;
+ with _ -> ()
)
let tcpip_packet_size = define_expert_option current_section
["tcpip_packet_size"]
@@ -1573,7 +1582,7 @@
if (Unix32.getsize !!log_file false)
> (Int64ops.megabytes !!log_file_size) then begin
Sys.remove !!log_file;
- lprintf_nl "Logfile %s resetted, bigger than %d MB" !!log_file
!!log_file_size
+ lprintf_nl "Logfile %s reset: bigger than %d MB" !!log_file
!!log_file_size
end;
let oc = open_out_gen [Open_creat; Open_wronly; Open_append] 0o644
!!log_file in
lprintf_to_file := true;
Index: mldonkey/src/daemon/common/commonTypes.ml
diff -u mldonkey/src/daemon/common/commonTypes.ml:1.46
mldonkey/src/daemon/common/commonTypes.ml:1.47
--- mldonkey/src/daemon/common/commonTypes.ml:1.46 Fri Dec 16 20:56:31 2005
+++ mldonkey/src/daemon/common/commonTypes.ml Fri Jan 6 22:23:09 2006
@@ -851,6 +851,17 @@
| _ -> "firewalled"
with _ -> ""
+let string_of_kind_geo kind =
+ try
+ match kind with
+ | Known_location (ip,port) ->
+ let cc,cn = Geoip.get_country ip in
+ (Ip.to_string ip),cc,cn
+ | _ ->
+ let cc,cn = !Geoip.unknown_country in
+ "firewalled",cc,cn
+ with _ -> "","X","Country error"
+
type brand_stat = {
mutable brand_seen : int;
mutable brand_banned : int;
Index: mldonkey/src/daemon/common/guiDecoding.ml
diff -u mldonkey/src/daemon/common/guiDecoding.ml:1.48
mldonkey/src/daemon/common/guiDecoding.ml:1.49
--- mldonkey/src/daemon/common/guiDecoding.ml:1.48 Mon Jan 2 12:08:14 2006
+++ mldonkey/src/daemon/common/guiDecoding.ml Fri Jan 6 22:23:09 2006
@@ -79,6 +79,22 @@
let get_string_bin s pos =
get_string s pos
+let get_ip2 proto s pos =
+ let ip,pos = get_ip s pos,(pos+4) in
+ if proto > 37 then
+ let _ = get_uint8 s pos in
+ ip,(pos+1)
+ else
+ ip,pos
+
+let get_hostname proto s pos =
+ let hn,pos = get_string s pos in
+ if proto > 37 then
+ let _ = get_uint8 s pos in
+ hn,(pos+1)
+ else
+ hn,pos
+
let get_list f s pos =
let len = get_int16 s pos in
let rec iter n pos =
@@ -89,6 +105,16 @@
in
iter len (pos+2)
+let get_list2 proto f s pos =
+ let len = get_int16 s pos in
+ let rec iter n pos =
+ if n = 0 then [],pos else
+ let head, pos = f proto s pos in
+ let tail, pos = iter (n-1) pos in
+ head :: tail, pos
+ in
+ iter len (pos+2)
+
let get_array f s pos =
let list, pos = get_list f s pos in
Array.of_list list, pos
@@ -372,7 +398,7 @@
let tag_name = field_of_string name in
tag_name, pos
-let get_tag s pos =
+let get_tag proto s pos =
let tag_name, pos = get_tag_name s pos in
let value, pos =
match get_uint8 s pos with
@@ -382,7 +408,8 @@
Fint64 (get_uint64_32 s (pos+1)), pos+5
| 2 -> let s, pos = get_string s (pos+1) in
String s, pos
- | 3 -> Addr (get_ip s (pos+1)), pos+5
+ | 3 -> let ip, pos = get_ip2 proto s (pos+1) in
+ Addr ip, pos
| 4 -> Uint16 (get_int16 s (pos+1)), pos+3
| 5 -> Uint8 (get_uint8 s (pos+1)), pos+2
| 6 -> Pair (get_uint64_32 s (pos+1), get_uint64_32 s (pos+5)), pos+9
@@ -403,7 +430,7 @@
let size, pos = get_uint64_2 proto s pos in
let format, pos = get_string s pos in
let t, pos = get_string s pos in
- let tags, pos = get_list get_tag s pos in
+ let tags, pos = get_list2 proto get_tag s pos in
let comment, pos = get_string s pos in
let already_done = get_bool s pos in
let time, pos =
@@ -620,10 +647,10 @@
let addr, pos =
match get_uint8 s pos with
0 ->
- let ip = get_ip s (pos+1) in
- Ip.addr_of_ip ip, pos+5
+ let ip, pos = get_ip2 proto s (pos+1) in
+ Ip.addr_of_ip ip, pos
| 1 ->
- let name,pos = get_string s (pos+1) in
+ let name,pos = get_hostname proto s (pos+1) in
Ip.addr_of_string name, pos
| _ -> assert false
in
@@ -643,7 +670,7 @@
in
let port = get_int16 s pos in
let score = get_int s (pos+2) in
- let tags, pos = get_list get_tag s (pos+6) in
+ let tags, pos = get_list2 proto get_tag s (pos+6) in
let nusers, pos = get_int64_28 proto s pos in
let nfiles, pos = get_int64_28 proto s pos in
let state, pos = get_host_state proto s pos in
@@ -675,14 +702,14 @@
| 2 -> client_contact_tag
| _ -> assert false
-let get_kind s pos =
+let get_kind proto s pos =
match get_uint8 s pos with
0 ->
- let ip = get_ip s (pos+1) in
- let port = get_int16 s (pos+5) in
- Known_location (ip, port), pos+7
+ let ip,pos = get_ip2 proto s (pos+1) in
+ let port = get_int16 s pos in
+ Known_location (ip, port), pos+2
| 1 ->
- let name, pos = get_string s (pos+1) in
+ let name, pos = get_hostname proto s (pos+1) in
let md4 = get_md4 s pos in
Indirect_location (name, md4), pos+16
| _ -> assert false
@@ -691,10 +718,10 @@
if proto <= 18 then
let num = get_int s pos in
let net = get_int s (pos+4) in
- let kind, pos = get_kind s (pos+8) in
+ let kind, pos = get_kind proto s (pos+8) in
let state,pos = get_host_state proto s pos in
let t = get_client_type s pos in
- let tags, pos = get_list get_tag s (pos+1) in
+ let tags, pos = get_list2 proto get_tag s (pos+1) in
let name, pos = get_string s pos in
let rating = get_int s pos in
let chat_port = get_int s (pos+4) in
@@ -722,10 +749,10 @@
else
let num = get_int s pos in
let net = get_int s (pos+4) in
- let kind, pos = get_kind s (pos+8) in
+ let kind, pos = get_kind proto s (pos+8) in
let state,pos = get_host_state proto s pos in
let t = get_client_type s pos in
- let tags, pos = get_list get_tag s (pos+1) in
+ let tags, pos = get_list2 proto get_tag s (pos+1) in
let name, pos = get_string s pos in
let rating = get_int s pos in
let software, pos = get_string s (pos+4) in
@@ -825,13 +852,13 @@
}, pos
-let get_user s pos =
+let get_user proto s pos =
let num = get_int s pos in
let md4 = get_md4 s (pos+4) in
let name, pos = get_string s (pos+20) in
- let ip = get_ip s pos in
- let port = get_int16 s (pos+4) in
- let tags, pos = get_list get_tag s (pos+6) in
+ let ip, pos = get_ip2 proto s pos in
+ let port = get_int16 s pos in
+ let tags, pos = get_list2 proto get_tag s (pos+6) in
let server = get_int s pos in
{
user_num = num;
@@ -1354,7 +1381,7 @@
Network_info network_info
| 21 ->
- let user_info, pos = get_user s 2 in
+ let user_info, pos = get_user proto s 2 in
User_info user_info
| 22 ->
Index: mldonkey/src/daemon/common/guiEncoding.ml
diff -u mldonkey/src/daemon/common/guiEncoding.ml:1.46
mldonkey/src/daemon/common/guiEncoding.ml:1.47
--- mldonkey/src/daemon/common/guiEncoding.ml:1.46 Mon Jan 2 12:08:14 2006
+++ mldonkey/src/daemon/common/guiEncoding.ml Fri Jan 6 22:23:09 2006
@@ -64,6 +64,10 @@
buf_int16 buf (List.length list);
List.iter (fun x -> f buf x) list
+let buf_list2 proto buf f list =
+ buf_int16 buf (List.length list);
+ List.iter (fun x -> f proto buf x) list
+
let buf_array buf f list =
buf_int16 buf (Array.length list);
Array.iter (fun x -> f buf x) list
@@ -87,6 +91,22 @@
let buf_string_bin buf s =
buf_string buf s
+let buf_hostname proto buf s =
+ buf_string buf s;
+ if proto > 37 then
+ let cc = 0 in (* TODO: figure out country# of this hostname *)
+ buf_int8 buf cc
+
+let buf_ip2 proto buf ip =
+ buf_ip buf ip;
+ if proto > 37 then begin
+ let cc =
+ try Geoip.get_country_code ip
+ with _ -> 0
+ in
+ buf_int8 buf cc
+ end
+
let buf_uid buf uid =
buf_string buf (Uid.to_string uid)
@@ -176,13 +196,13 @@
buf_list buf buf_query list
| Q_COMBO _ -> assert false
-let buf_tag buf t =
+let buf_tag proto buf t =
buf_string buf (string_of_field t.tag_name);
match t.tag_value with
| Uint64 s -> buf_int8 buf 0; buf_int64_32 buf s
| Fint64 s -> buf_int8 buf 1; buf_int64_32 buf s
| String s -> buf_int8 buf 2; buf_string buf s
- | Addr ip -> buf_int8 buf 3; buf_ip buf ip
+ | Addr ip -> buf_int8 buf 3; buf_ip2 proto buf ip
| Uint16 n -> buf_int8 buf 4; buf_int16 buf n
| Uint8 n -> buf_int8 buf 5; buf_int8 buf n
| Pair (n1,n2) -> buf_int8 buf 6; buf_int64_32 buf n1; buf_int64_32 buf n2
@@ -244,20 +264,20 @@
buf_int64_2 proto buf r.result_size;
buf_string buf r.result_format;
buf_string buf r.result_type;
- buf_list buf buf_tag r.result_tags;
+ buf_list2 proto buf buf_tag r.result_tags;
buf_string buf r.result_comment;
buf_bool buf r.result_done;
if proto > 26 then
let date = r.result_time in
buf_int buf (last_time () - date)
-let buf_user buf u =
+let buf_user proto buf u =
buf_int buf u.user_num;
buf_md4 buf u.user_md4;
buf_string buf u.user_name;
- buf_ip buf u.user_ip;
+ buf_ip2 proto buf u.user_ip;
buf_int16 buf u.user_port;
- buf_list buf buf_tag u.user_tags;
+ buf_list2 proto buf buf_tag u.user_tags;
buf_int buf u.user_server
let buf_room_state buf s =
@@ -374,12 +394,12 @@
buf_list buf buf_ogg ogg_infos;
end else buf_int8 buf 0
-let buf_kind buf k =
+let buf_kind proto buf k =
match k with
Known_location (ip, port) ->
- buf_int8 buf 0; buf_ip buf ip; buf_int16 buf port
+ buf_int8 buf 0; buf_ip2 proto buf ip; buf_int16 buf port
| Indirect_location (name, md4) ->
- buf_int8 buf 1; buf_string buf name; buf_md4 buf md4
+ buf_int8 buf 1; buf_hostname proto buf name; buf_md4 buf md4
let buf_partial_file proto buf f =
buf_int buf f.file_num;
@@ -568,10 +588,11 @@
(match addr with
Ip.AddrIp ip ->
buf_int8 buf 0;
- buf_ip buf ip
+ buf_ip2 proto buf ip
| Ip.AddrName s ->
buf_int8 buf 1;
- buf_string buf s);
+ buf_hostname proto buf s
+ );
if proto > 33 then begin
let is_blocked =
try
@@ -591,7 +612,7 @@
buf_addr proto buf s.server_addr;
buf_int16 buf s.server_port;
buf_int buf s.server_score;
- buf_list buf buf_tag s.server_tags;
+ buf_list2 proto buf buf_tag s.server_tags;
buf_int64_28 proto buf s.server_nusers;
buf_int64_28 proto buf s.server_nfiles;
buf_host_state proto buf s.server_state;
@@ -603,10 +624,10 @@
let buf_client proto buf c =
buf_int buf c.client_num;
buf_int buf c.client_network;
- buf_kind buf c.client_kind;
+ buf_kind proto buf c.client_kind;
buf_host_state proto buf c.client_state;
buf_client_type buf c.client_type;
- buf_list buf buf_tag c.client_tags;
+ buf_list2 proto buf buf_tag c.client_tags;
buf_string buf c.client_name;
buf_int buf c.client_rating;
if proto <= 18 then begin
@@ -800,7 +821,8 @@
buf_network proto buf network_info
| User_info user_info -> buf_opcode buf 21;
- buf_user buf user_info
+ let proto = proto.(21) in
+ buf_user proto buf user_info
| Room_info room_info ->
let proto = proto.(31) in
Index: mldonkey/src/daemon/common/guiProto.ml
diff -u mldonkey/src/daemon/common/guiProto.ml:1.21
mldonkey/src/daemon/common/guiProto.ml:1.22
--- mldonkey/src/daemon/common/guiProto.ml:1.21 Mon Jan 2 12:08:14 2006
+++ mldonkey/src/daemon/common/guiProto.ml Fri Jan 6 22:23:09 2006
@@ -31,7 +31,7 @@
let to_gui_last_opcode = 58
let from_gui_last_opcode = 67
-let best_gui_version = 37
+let best_gui_version = 38
(* I will try to report all changes to the protocol here: send me patches
if I don't !
Index: mldonkey/src/daemon/driver/driverCommands.ml
diff -u mldonkey/src/daemon/driver/driverCommands.ml:1.110
mldonkey/src/daemon/driver/driverCommands.ml:1.111
--- mldonkey/src/daemon/driver/driverCommands.ml:1.110 Wed Jan 4 14:11:55 2006
+++ mldonkey/src/daemon/driver/driverCommands.ml Fri Jan 6 22:23:09 2006
@@ -377,6 +377,7 @@
( "1", "srh ac", "Client number", "Num" ) ;
( "0", "srh", "Network", "Network" ) ;
( "0", "srh", "IP address", "IP address" ) ;
+ ] @ (if !Geoip.active then [( "0", "srh", "Country Code/Name",
"CC" )] else []) @ [
( "0", "srh", "Client name", "Client name" ) ;
( "0", "srh", "Client brand", "CB" ) ;
( "0", "srh", "Client release", "CR" ) ;
@@ -2290,13 +2291,16 @@
html_mods_td buf [
("", "sr", Printf.sprintf "%d" (client_num c)); ];
+ let ips,cc,cn = string_of_kind_geo i.client_kind in
+
client_print_html c o;
html_mods_td buf ([
("", "sr", (match i.client_sui_verified with
| None -> "N"
| Some b -> if b then "P" else "F"
));
- ("", "sr", (string_of_kind i.client_kind));
+ ("", "sr", ips);
+ ] @ (if !Geoip.active then [(cn, "sr", cc)] else
[]) @ [
("", "sr", Printf.sprintf "%d" (((last_time ()) -
i.client_connect_time) / 60));
("", "sr", i.client_software);
("", "sr", i.client_release);
@@ -2514,6 +2518,7 @@
( "0", "srh", "Connection [I]ndirect, [D]irect", "C" ) ;
( "0", "srh", "Secure User Identification [N]one, [P]assed,
[F]ailed", "S" ) ;
( "0", "srh", "IP address", "IP address" ) ;
+ ] @ (if !Geoip.active then [( "0", "srh", "Country Code/Name",
"CC" )] else []) @ [
( "1", "srh ar", "Total UL bytes to this client for all files",
"UL" ) ;
( "1", "srh ar", "Total DL bytes from this client for all
files", "DL" ) ;
( "0", "srh", "Filename", "Filename" ) ]);
Index: mldonkey/src/daemon/driver/driverMain.ml
diff -u mldonkey/src/daemon/driver/driverMain.ml:1.86
mldonkey/src/daemon/driver/driverMain.ml:1.87
--- mldonkey/src/daemon/driver/driverMain.ml:1.86 Wed Dec 28 21:37:39 2005
+++ mldonkey/src/daemon/driver/driverMain.ml Fri Jan 6 22:23:09 2006
@@ -625,6 +625,7 @@
DriverInteractive.save_config ();
CommonComplexOptions.save_sources ();
CommonComplexOptions.backup_options ();
+ Geoip.close ();
Unix32.external_exit ();
lprintf_nl (_b "Core stopped")
);
Index: mldonkey/src/networks/bittorrent/bTInteractive.ml
diff -u mldonkey/src/networks/bittorrent/bTInteractive.ml:1.74
mldonkey/src/networks/bittorrent/bTInteractive.ml:1.75
--- mldonkey/src/networks/bittorrent/bTInteractive.ml:1.74 Mon Jan 2
12:08:14 2006
+++ mldonkey/src/networks/bittorrent/bTInteractive.ml Fri Jan 6 22:23:09 2006
@@ -272,18 +272,18 @@
None -> "" | Some swarmer ->
Int64Swarmer.verified_bitmap swarmer) in
- html_mods_table_header buf "sourcesTable" "sources al" [
+ let header_list = [
( "1", "srh br ac", "Client number", "Num" ) ;
( "0", "srh br", "Client UID", "UID" ) ;
( "0", "srh br", "Client software", "Soft" ) ;
( "0", "srh", "IP address", "IP address" ) ;
( "0", "srh br ar", "Port", "Port" ) ;
+ ] @ (if !Geoip.active then [( "0", "srh br ar", "Country Code/Name",
"CC" )] else []) @ [
( "1", "srh ar", "Total UL bytes to this client for all files", "UL" )
;
( "1", "srh ar br", "Total DL bytes from this client for all files",
"DL" ) ;
( "0", "srh ar", "Interested [T]rue, [F]alse", "I" ) ;
( "0", "srh ar", "Choked [T]rue, [F]alse", "C" ) ;
( "1", "srh br ar", "Allowed to write", "A" ) ;
-
( "0", "srh ar", "Interesting [T]rue, [F]alse", "I" );
( "0", "srh ar", "Already sent interested [T]rue, [F]alse", "A" );
( "0", "srh br ar", "Already sent not interested [T]rue, [F]alse", "N"
);
@@ -303,17 +303,22 @@
*)
( "1", "srh ar", "Number of full chunks", (Printf.sprintf "%d"
(String.length (String2.replace
- (String2.replace chunks '0' "") '1' "")) )) ] ;
+ (String2.replace chunks '0' "") '1' "")) ))
+ ] in
+
+ html_mods_table_header buf "sourcesTable" "sources al" header_list;
Hashtbl.iter (fun _ c ->
Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr());
- html_mods_td buf [
+ let cc,cn = Geoip.get_country (fst c.client_host) in
+ let td_list = [
("", "sr br ar", Printf.sprintf "%d" (client_num c));
("", "sr br", (Sha1.to_string c.client_uid));
("", "sr br", Printf.sprintf "%s %s" (brand_to_string
c.client_brand) c.client_release);
("", "sr", (Ip.to_string (fst c.client_host)));
("", "sr br ar", Printf.sprintf "%d" (snd c.client_host));
+ ] @ (if !Geoip.active then [( cn, "sr br", cc)] else []) @ [
("", "sr ar", (size_of_int64 c.client_uploaded));
("", "sr ar br", (size_of_int64 c.client_downloaded));
("", "sr", (if c.client_interested then "T" else "F"));
@@ -340,8 +345,10 @@
None -> ()
| Some bitmap ->
Bitv.iter (fun s -> if s then incr fc) bitmap);
- (Printf.sprintf "%d" !fc) ) ) ];
+ (Printf.sprintf "%d" !fc) ) )
+ ] in
+ html_mods_td buf td_list;
Printf.bprintf buf "\\</tr\\>";
) file.file_clients;
@@ -754,8 +761,8 @@
let op_client_dprint_html c o file str =
let info = file_info file in
let buf = o.conn_buf in
- let cc = as_client c in
- let cinfo = client_info cc in
+ let ac = as_client c in
+ let cinfo = client_info ac in
Printf.bprintf buf " \\<tr onMouseOver=\\\"mOvr(this);\\\"
onMouseOut=\\\"mOut(this);\\\" class=\\\"%s\\\"\\>" str;
@@ -765,10 +772,12 @@
show_emulemods_column := true
end;
+ let cc,cn = Geoip.get_country (fst c.client_host) in
+
html_mods_td buf ([
("", "srb ar", Printf.sprintf "%d" (client_num c));
- ((string_of_connection_state (client_state cc)), "sr",
- (short_string_of_connection_state (client_state cc)));
+ ((string_of_connection_state (client_state ac)), "sr",
+ (short_string_of_connection_state (client_state ac)));
((Sha1.to_string c.client_uid), "sr", cinfo.GuiTypes.client_name);
("", "sr", (brand_to_string c.client_brand)); (*
cinfo.GuiTypes.client_software *)
("", "sr", c.client_release);
@@ -781,6 +790,7 @@
("", "sr", "D");
("", "sr", "N");
("", "sr", (Ip.to_string (fst c.client_host)));
+ ] @ (if !Geoip.active then [(cn, "sr", cc)] else []) @ [
("", "sr ar", (size_of_int64 c.client_uploaded));
("", "sr ar", (size_of_int64 c.client_downloaded));
("", "sr", info.GuiTypes.file_name); ]);
Index: mldonkey/src/networks/donkey/donkeyInteractive.ml
diff -u mldonkey/src/networks/donkey/donkeyInteractive.ml:1.79
mldonkey/src/networks/donkey/donkeyInteractive.ml:1.80
--- mldonkey/src/networks/donkey/donkeyInteractive.ml:1.79 Wed Jan 4
14:11:55 2006
+++ mldonkey/src/networks/donkey/donkeyInteractive.ml Fri Jan 6 22:23:09 2006
@@ -476,38 +476,32 @@
name
*)
+(*
let print_file buf file =
Printf.bprintf buf "[%-5d] %s %10Ld %32s %s"
- (file_num file)
- (file_best_name file)
- (file_size file)
- (Md4.to_string file.file_md4)
- (if file_state file = FileDownloaded then
- "Done" else
- Int64.to_string (file_downloaded file));
+ (file_num file) (file_best_name file) (file_size file) (Md4.to_string
file.file_md4)
+ (if file_state file = FileDownloaded then "Done"
+ else Int64.to_string (file_downloaded file));
+
Buffer.add_char buf '\n';
+
Printf.bprintf buf "Connected clients:\n";
+
+ let sock_to_string c =
+ match c.client_source.DonkeySources.source_sock with
+ NoConnection -> string_of_date
(c.client_source.DonkeySources.source_age)
+ | ConnectionWaiting _ -> "Connecting"
+ | Connection _ -> "Connected"
+ in
+
let f _ c =
match c.client_kind with
Direct_address (ip, port) ->
Printf.bprintf buf "[%-5d] %12s %-5d %s\n"
- (client_num c)
- (Ip.to_string ip)
- port
- (match c.client_source.DonkeySources.source_sock with
- NoConnection ->
- string_of_date (c.client_source.DonkeySources.source_age)
- | ConnectionWaiting _ -> "Connecting"
- | Connection _ -> "Connected")
+ (client_num c) (Ip.to_string ip) port (sock_to_string c)
| _ ->
Printf.bprintf buf "[%-5d] %12s %s\n"
- (client_num c)
- "Indirect"
- (match c.client_source.DonkeySources.source_sock with
- NoConnection ->
- string_of_date (c.client_source.DonkeySources.source_age)
- | ConnectionWaiting _ -> "Connecting"
- | Connection _ -> "Connected")
+ (client_num c) "Indirect" (sock_to_string c)
in
(* Intmap.iter f file.file_sources; *)
@@ -516,6 +510,7 @@
| Some swarmer ->
let bitmap = Int64Swarmer.verified_bitmap swarmer in
Printf.bprintf buf "\nChunks: %s\n" bitmap
+*)
let recover_md4s md4 =
let file = find_file md4 in
@@ -1025,6 +1020,7 @@
module P = GuiTypes
+
(* How often is this function called when the interface is running ?
is it called when no interface is connected ? it should be as fast
as possible. *)
@@ -1118,6 +1114,19 @@
| _ -> ""
with _ -> ""
+let get_ips_cc_cn c =
+ try
+ match c.client_kind with
+ Direct_address (ip,port) ->
+ let cc,cn = Geoip.get_country ip in
+ Printf.sprintf "%s" (Ip.to_string ip)
+ ,cc,cn
+ | _ ->
+ let cc,cn = !Geoip.unknown_country in
+ (string_of_client_addr c),cc,cn
+ with _ -> ("X","??","Country Error")
+
+
let _ =
client_ops.op_client_info <- (fun c ->
{
@@ -1332,6 +1341,7 @@
( "0", "srh", "Connection [I]ndirect, [D]irect", "C" ) ;
( "0", "srh", "Secure User Identification [N]one, [P]assed,
[F]ailed", "S" ) ;
( "0", "srh br", "IP address", "IP address" ) ;
+ ] @ (if !Geoip.active then [( "0", "srh br", "Country Code/Name",
"CC" )] else []) @ [
( "1", "srh ar", "Total UL bytes to this client for all files", "UL"
) ;
( "1", "srh ar br", "Total DL bytes from this client for all files",
"DL" ) ;
( "1", "srh ar", "Your queue rank on this client", "Rnk" ) ;
@@ -1376,6 +1386,8 @@
if t = 0 then "N" else Printf.sprintf "%d" ((last_time() - t)
/ 60))
with _ -> ("?","?","?") in
+ let ip_string,cc,cn = get_ips_cc_cn c in
+
html_mods_td buf ([
("", "sr", (match c.client_download with
None -> ""
@@ -1403,9 +1415,8 @@
| None -> "N"
| Some b -> if b then "P" else "F"
));
- ("", "sr br", match c.client_kind with
- Direct_address (ip,port) -> Printf.sprintf "%s" (Ip.to_string
ip)
- | _ -> (string_of_client_addr c));
+ ("", "sr br", ip_string);
+ ] @ (if !Geoip.active then [(cn, "sr br", cc)] else []) @ [
("", "sr ar", (size_of_int64 c.client_uploaded));
("", "sr ar br", (size_of_int64 c.client_downloaded));
("", "sr ar", Printf.sprintf "%d" c.client_rank);
@@ -1649,6 +1660,8 @@
onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"\\>%d\\</TD\\>"
str (client_num c) (client_num c);
+ let ip_string,cc,cn = get_ips_cc_cn c in
+
html_mods_td buf ([
(string_of_connection_state (client_state c), "sr",
short_string_of_connection_state (client_state c));
@@ -1669,9 +1682,8 @@
| None -> "N"
| Some b -> if b then "P" else "F"
));
- ("", "sr", match c.client_kind with
- Direct_address (ip,port) -> Printf.sprintf "%s"
(Ip.to_string ip)
- | _ -> (string_of_client_addr c));
+ ("", "sr", ip_string);
+ ] @ (if !Geoip.active then [(cn, "sr", cc)] else []) @ [
("", "sr ar", (size_of_int64 c.client_uploaded));
("", "sr ar", (size_of_int64 c.client_downloaded));
("", "sr", info.GuiTypes.file_name) ]);
Index: mldonkey/src/networks/fileTP/fileTPInteractive.ml
diff -u mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.25
mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.26
--- mldonkey/src/networks/fileTP/fileTPInteractive.ml:1.25 Fri Dec 16
20:56:31 2005
+++ mldonkey/src/networks/fileTP/fileTPInteractive.ml Fri Jan 6 22:23:09 2006
@@ -184,6 +184,7 @@
("", "sr", "D");
("", "sr", "N");
("", "sr", (string_of_client_addr c));
+ ] @ (if !Geoip.active then [("?", "sr", "?")] else []) @ [
("", "sr ar", (size_of_int64 cinfo.GuiTypes.client_uploaded));
("", "sr ar", (size_of_int64 cinfo.GuiTypes.client_downloaded));
("", "sr", info.GuiTypes.file_name); ]);
Index: mldonkey/src/networks/gnutella/gnutellaInteractive.ml
diff -u mldonkey/src/networks/gnutella/gnutellaInteractive.ml:1.45
mldonkey/src/networks/gnutella/gnutellaInteractive.ml:1.46
--- mldonkey/src/networks/gnutella/gnutellaInteractive.ml:1.45 Fri Dec 16
20:56:31 2005
+++ mldonkey/src/networks/gnutella/gnutellaInteractive.ml Fri Jan 6
22:23:09 2006
@@ -495,6 +495,7 @@
("", "sr", "D");
("", "sr", "N");
("", "sr", (string_of_kind cinfo.GuiTypes.client_kind));
+ ] @ (if !Geoip.active then [("?", "sr", "?")] else []) @ [
("", "sr ar", (size_of_int64 cinfo.GuiTypes.client_uploaded));
("", "sr ar", (size_of_int64 cinfo.GuiTypes.client_downloaded));
("", "sr", info.GuiTypes.file_name); ]);
- [Mldonkey-commits] mldonkey config/Makefile.in distrib/ChangeLog s...,
mldonkey-commits <=