[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co... |
Date: |
Mon, 16 Jan 2006 16:05:14 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Branch:
Changes by: spiralvoice <address@hidden> 06/01/16 16:05:14
Modified files:
distrib : ChangeLog
src/daemon/common: commonClient.ml commonClient.mli
commonFile.ml commonFile.mli commonServer.ml
guiDecoding.ml guiEncoding.ml guiProto.ml
guiTypes.ml
src/networks/bittorrent: bTInteractive.ml
src/networks/donkey: donkeyClient.ml donkeyGlobals.ml
donkeyInteractive.ml donkeyProtoCom.ml
donkeyProtoCom.mli donkeyProtoUdp.ml
donkeyServers.ml donkeyTypes.ml
donkeyUdp.ml
src/networks/gnutella: gnutellaInteractive.ml
src/networks/opennap: opennapInteractive.ml
Log message:
patch #4801
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.678&tr2=1.679&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonClient.ml.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonClient.mli.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonFile.ml.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonFile.mli.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonServer.ml.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiDecoding.ml.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiEncoding.ml.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiProto.ml.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/guiTypes.ml.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml.diff?tr1=1.77&tr2=1.78&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml.diff?tr1=1.80&tr2=1.81&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyGlobals.ml.diff?tr1=1.71&tr2=1.72&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml.diff?tr1=1.84&tr2=1.85&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyProtoCom.ml.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyProtoCom.mli.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyProtoUdp.ml.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyServers.ml.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyTypes.ml.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyUdp.ml.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/gnutella/gnutellaInteractive.ml.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/opennap/opennapInteractive.ml.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.678 mldonkey/distrib/ChangeLog:1.679
--- mldonkey/distrib/ChangeLog:1.678 Mon Jan 16 16:02:44 2006
+++ mldonkey/distrib/ChangeLog Mon Jan 16 16:05:14 2006
@@ -15,6 +15,7 @@
=========
2006/01/16
+4801: EDK: add more server info fields (html and guiprot) (zet)
4798: Fix thread recognition on *BSD
2006/01/15
Index: mldonkey/src/daemon/common/commonClient.ml
diff -u mldonkey/src/daemon/common/commonClient.ml:1.25
mldonkey/src/daemon/common/commonClient.ml:1.26
--- mldonkey/src/daemon/common/commonClient.ml:1.25 Mon Jan 9 00:22:35 2006
+++ mldonkey/src/daemon/common/commonClient.ml Mon Jan 16 16:05:14 2006
@@ -465,3 +465,27 @@
end
with _ -> ()
) !uploaders
+
+let impl_client_info impl =
+ let module T = GuiTypes in
+ {
+ T.client_num = impl.impl_client_num;
+ T.client_state = impl.impl_client_state;
+ T.client_type = impl.impl_client_type;
+
+ T.client_tags = [];
+ T.client_name = "";
+ T.client_network = 0;
+ T.client_files = None;
+ T.client_rating = 0;
+ T.client_chat_port = 0;
+ T.client_connect_time = BasicSocket.last_time ();
+ T.client_kind = Indirect_location ("", Md4.Md4.null, Ip.null, 0);
+ T.client_software = "";
+ T.client_release = "";
+ T.client_emulemod = "";
+ T.client_downloaded = 0L;
+ T.client_uploaded = 0L;
+ T.client_upload = None;
+ T.client_sui_verified = None;
+ }
Index: mldonkey/src/daemon/common/commonClient.mli
diff -u mldonkey/src/daemon/common/commonClient.mli:1.9
mldonkey/src/daemon/common/commonClient.mli:1.10
--- mldonkey/src/daemon/common/commonClient.mli:1.9 Sat Nov 19 16:11:37 2005
+++ mldonkey/src/daemon/common/commonClient.mli Mon Jan 16 16:05:14 2006
@@ -94,3 +94,4 @@
val client_has_bitmap : CommonTypes.client -> CommonTypes.file -> string ->
unit
val clear_upload_slots : unit -> unit
+val impl_client_info : 'a client_impl -> GuiTypes.client_info
Index: mldonkey/src/daemon/common/commonFile.ml
diff -u mldonkey/src/daemon/common/commonFile.ml:1.49
mldonkey/src/daemon/common/commonFile.ml:1.50
--- mldonkey/src/daemon/common/commonFile.ml:1.49 Mon Jan 9 00:25:58 2006
+++ mldonkey/src/daemon/common/commonFile.ml Mon Jan 16 16:05:14 2006
@@ -95,6 +95,7 @@
mutable op_file_proposed_filenames : ('a -> string list);
}
+
(*************************************************************************)
(* *)
(* as_file... *)
@@ -978,3 +979,32 @@
let com_files_by_num = files_by_num
let files_by_num = ()
+
+let impl_file_info impl =
+ let module T = GuiTypes in
+ {
+ T.file_fields = T.Fields_file_info.all;
+ T.file_comment = impl.impl_file_comment;
+ T.file_name = impl.impl_file_best_name;
+ T.file_num = impl.impl_file_num;
+ T.file_size = impl.impl_file_size;
+ T.file_downloaded = impl.impl_file_downloaded;
+ T.file_state = impl.impl_file_state;
+ T.file_download_rate = file_download_rate impl;
+ T.file_priority = impl.impl_file_priority;
+ T.file_age = impl.impl_file_age;
+ T.file_last_seen = impl.impl_file_last_seen;
+
+ T.file_network = 0;
+ T.file_names = [];
+ T.file_md4 = Md4.null;
+ T.file_all_sources = 0;
+ T.file_active_sources = 0;
+ T.file_sources = None;
+ T.file_chunks = "";
+ T.file_availability = [];
+ T.file_format = FormatNotComputed 0;
+ T.file_chunks_age = [||];
+ T.file_uids = [];
+ T.file_sub_files = [];
+ }
Index: mldonkey/src/daemon/common/commonFile.mli
diff -u mldonkey/src/daemon/common/commonFile.mli:1.12
mldonkey/src/daemon/common/commonFile.mli:1.13
--- mldonkey/src/daemon/common/commonFile.mli:1.12 Mon Jan 9 00:25:58 2006
+++ mldonkey/src/daemon/common/commonFile.mli Mon Jan 16 16:05:14 2006
@@ -129,3 +129,4 @@
val propose_filename : CommonTypes.file -> unit
val forceable_download : CommonTypes.result_info list ref
+val impl_file_info : 'a file_impl -> GuiTypes.file_info
Index: mldonkey/src/daemon/common/commonServer.ml
diff -u mldonkey/src/daemon/common/commonServer.ml:1.24
mldonkey/src/daemon/common/commonServer.ml:1.25
--- mldonkey/src/daemon/common/commonServer.ml:1.24 Thu Jan 12 08:57:58 2006
+++ mldonkey/src/daemon/common/commonServer.ml Mon Jan 16 16:05:14 2006
@@ -91,6 +91,32 @@
let dummy_server = as_server dummy_server_impl
+let impl_server_info impl =
+ let module T = GuiTypes in
+ {
+ T.server_num = impl.impl_server_num;
+ T.server_state = impl.impl_server_state;
+
+ T.server_network = 0;
+ T.server_addr = Ip.addr_of_ip Ip.null;
+ T.server_port = 0;
+ T.server_realport = 0;
+ T.server_score = 0;
+ T.server_tags = [];
+ T.server_nusers = 0L;
+ T.server_nfiles = 0L;
+ T.server_name = "";
+ T.server_description = "";
+ T.server_users = None;
+ T.server_banner = "";
+ T.server_preferred = false;
+ T.server_version = "";
+ T.server_max_users = 0L;
+ T.server_soft_limit = 0L;
+ T.server_hard_limit = 0L;
+ T.server_lowid_users = 0L;
+ T.server_ping = 0;
+ }
let server_num s =
let s = as_server_impl s in
@@ -303,7 +329,7 @@
let info = server_info s in
(match impl.impl_server_state with
NotConnected _ -> ()
- | _ -> server_disconnect s;
+ | _ -> server_disconnect s;
lprintf_nl () "Disconnected server %s (%s:%d), IP is now blocked"
info.G.server_name
(Ip.string_of_addr info.G.server_addr)
@@ -321,19 +347,24 @@
let server_print_html_header buf ext =
html_mods_table_header buf "serversTable" (Printf.sprintf "servers%s" ext)
[
- ( "1", "srh", "Server number", "#" ) ;
- ( "0", "srh", "Connect|Disconnect", "C/D" ) ;
- ( "0", "srh", "Remove", "Rem" ) ;
- ( "0", "srh", "Preferred", "P" ) ;
- ( "0", "srh", "[Hi]gh or [Lo]w ID", "ID" ) ;
- ( "0", "srh", "Network name", "Network" ) ;
- ( "0", "srh", "Connection status", "Status" ) ;
- ( "0", "srh br", "IP address", "IP address" ) ;
- ( "1", "srh ar", "Number of connected users", "Users" ) ;
- ( "1", "srh ar br", "Number of files indexed on server",
"Files" ) ;
- ( "0", "srh", "Server name", "Name" ) ;
- ( "0", "srh", "Server version", "Version" ) ;
- ( "0", "srh", "Server details", "Details" ) ]
+ ( "1", "srh", "Server number", "#" ) ;
+ ( "0", "srh", "Connect|Disconnect", "C/D" ) ;
+ ( "0", "srh", "Remove", "Rem" ) ;
+ ( "0", "srh", "Preferred", "P" ) ;
+ ( "0", "srh", "[Hi]gh or [Lo]w ID", "ID" ) ;
+ ( "0", "srh", "Network name", "Network" ) ;
+ ( "0", "srh", "Connection status", "Status" ) ;
+ ( "0", "srh br", "IP address", "IP address" ) ;
+ ( "1", "srh ar", "Number of connected users", "Users" ) ;
+ ( "1", "srh ar br", "Max number of users", "MaxUsers" ) ;
+ ( "1", "srh ar br", "LowID users", "LowID" ) ;
+ ( "1", "srh ar br", "Number of files indexed on server", "Files" ) ;
+ ( "1", "srh ar", "Soft file limit", "Soft" ) ;
+ ( "1", "srh ar br", "Hard file limit", "Hard" ) ;
+ ( "0", "srh ar br", "Ping (ms)", "Ping" ) ;
+ ( "0", "srh", "Server version", "Version" ) ;
+ ( "0", "srh", "Server name", "Name" ) ;
+ ( "0", "srh", "Server details", "Details" ) ]
let server_print s o =
let impl = as_server_impl s in
@@ -346,9 +377,9 @@
raise e in
let buf = o.conn_buf in
-
- if use_html_mods o then begin
- let snum = (server_num s) in
+
+ if use_html_mods o then begin
+ let snum = (server_num s) in
Printf.bprintf buf "
\\<tr class=\\\"dl-%d\\\"\\>
@@ -362,24 +393,29 @@
\\<td class=\\\"sr br\\\"\\>%s:%s\\</td\\>
\\<td class=\\\"sr ar\\\"\\>%Ld\\</td\\>
\\<td class=\\\"sr ar br\\\"\\>%Ld\\</td\\>
- \\<td class=\\\"sr\\\"\\>%s\\</td\\>
+ \\<td class=\\\"sr ar br\\\"\\>%Ld\\</td\\>
+ \\<td class=\\\"sr ar br\\\"\\>%Ld\\</td\\>
+ \\<td class=\\\"sr ar\\\"\\>%Ld\\</td\\>
+ \\<td class=\\\"sr ar br\\\"\\>%Ld\\</td\\>
+ \\<td class=\\\"sr ar br\\\"\\>%d\\</td\\>
+ \\<td class=\\\"sr br\\\"\\>%s\\</td\\>
\\<td class=\\\"sr\\\"\\>%s\\</td\\>
\\<td width=\\\"100%%\\\" class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>\n"
(html_mods_cntr ())
- (
+ (
Printf.sprintf "%s"
(match impl.impl_server_state with
Connected _ -> Printf.sprintf "title=\\\"Server Banner\\\"
- onMouseOver=\\\"mOvr(this);\\\"
- onMouseOut=\\\"mOut(this);\\\"
-
onClick=\\\"location.href='submit?q=server_banner+%d'\\\"" snum
+ onMouseOver=\\\"mOvr(this);\\\"
+ onMouseOut=\\\"mOut(this);\\\"
+ onClick=\\\"location.href='submit?q=server_banner+%d'\\\"" snum
| _ -> "")
- )
- snum
+ )
+ snum
(
if server_blocked s && (match impl.impl_server_state with
- NotConnected _ -> true
- | _ -> false) then "\\<td
class=\\\"srb\\\"\\>blk\\</td\\>" else
+ NotConnected _ -> true
+ | _ -> false) then "\\<td class=\\\"srb\\\"\\>blk\\</td\\>" else
Printf.sprintf
"\\<TD class=\\\"srb\\\" onMouseOver=\\\"mOvr(this);\\\"
onMouseOut=\\\"mOut(this);\\\" title=\\\"Connect|Disconnect\\\"
@@ -447,38 +483,44 @@
n.network_name
(match impl.impl_server_state with
NotConnected _ -> if server_blocked s then "IP blocked"
- else (string_of_connection_state
impl.impl_server_state)
+ else (string_of_connection_state impl.impl_server_state)
| _ -> (string_of_connection_state impl.impl_server_state))
(Ip.string_of_addr info.G.server_addr)
(Printf.sprintf "%s%s"
(string_of_int info.G.server_port)
- (if info.G.server_realport <> 0 then
- "(" ^ (string_of_int info.G.server_realport) ^ ")" else ""))
+ (if info.G.server_realport <> 0
+ then "(" ^ (string_of_int info.G.server_realport) ^ ")"
+ else ""))
info.G.server_nusers
+ info.G.server_max_users
+ info.G.server_lowid_users
info.G.server_nfiles
- info.G.server_name
+ info.G.server_soft_limit
+ info.G.server_hard_limit
+ info.G.server_ping
info.G.server_version
+ info.G.server_name
info.G.server_description
- end
+ end
else
- begin
+ begin
Printf.bprintf buf "[%-10s%5d] %15s:%-10s %s\n%45sUsers:%-8Ld
Files:%-8Ld State:%s\n"
(n.network_name)
(server_num s)
(Ip.string_of_addr info.G.server_addr)
(Printf.sprintf "%s%s"
- (string_of_int info.G.server_port)
- (if info.G.server_realport <> 0 then
- "(" ^ (string_of_int info.G.server_realport) ^ ")" else ""))
+ (string_of_int info.G.server_port)
+ (if info.G.server_realport <> 0
+ then "(" ^ (string_of_int info.G.server_realport) ^ ")"
+ else ""))
(info.G.server_name) ("")
(info.G.server_nusers)
(info.G.server_nfiles)
- (if server_blocked s then
- "IP blocked"
- else
- (string_of_connection_state impl.impl_server_state));
+ (if server_blocked s
+ then "IP blocked"
+ else (string_of_connection_state impl.impl_server_state));
end;
with e ->
Index: mldonkey/src/daemon/common/guiDecoding.ml
diff -u mldonkey/src/daemon/common/guiDecoding.ml:1.51
mldonkey/src/daemon/common/guiDecoding.ml:1.52
--- mldonkey/src/daemon/common/guiDecoding.ml:1.51 Thu Jan 12 08:57:58 2006
+++ mldonkey/src/daemon/common/guiDecoding.ml Mon Jan 16 16:05:14 2006
@@ -677,6 +677,19 @@
let name, pos = get_string s pos in
let description, pos = get_string s pos in
let preferred = if proto > 28 then get_bool s pos else false in
+ let pos=pos+1 in
+ let ve,ma,lo,so,ha,pi,pos =
+ if proto > 39 then
+ let ve,pos = get_string s pos in
+ let ma,pos = get_int64 s pos, (pos+8) in
+ let lo,pos = get_int64 s pos, (pos+8) in
+ let so,pos = get_int64 s pos, (pos+8) in
+ let ha,pos = get_int64 s pos, (pos+8) in
+ let pi,pos = get_int s pos, (pos+4) in
+ ve,ma,lo,so,ha,pi,pos
+ else
+ "",0L,0L,0L,0L,0,pos
+ in
{
server_num = num;
server_network = net;
@@ -693,7 +706,12 @@
server_banner = "";
server_users = None;
server_preferred = preferred;
- server_version = "";
+ server_version = ve;
+ server_max_users = ma;
+ server_lowid_users = lo;
+ server_soft_limit = so;
+ server_hard_limit = ha;
+ server_ping = pi;
}, pos
let get_client_type s pos =
Index: mldonkey/src/daemon/common/guiEncoding.ml
diff -u mldonkey/src/daemon/common/guiEncoding.ml:1.49
mldonkey/src/daemon/common/guiEncoding.ml:1.50
--- mldonkey/src/daemon/common/guiEncoding.ml:1.49 Thu Jan 12 08:57:58 2006
+++ mldonkey/src/daemon/common/guiEncoding.ml Mon Jan 16 16:05:14 2006
@@ -617,13 +617,18 @@
buf_int64_28 proto buf s.server_nusers;
buf_int64_28 proto buf s.server_nfiles;
buf_host_state proto buf s.server_state;
- if s.server_version = "" then
- buf_string buf s.server_name
- else
- buf_string buf (Printf.sprintf "%s (%s)" s.server_name s.server_version);
+ buf_string buf s.server_name;
buf_string buf s.server_description;
if proto > 28 then
- buf_bool buf s.server_preferred
+ buf_bool buf s.server_preferred;
+ if proto > 39 then begin
+ buf_string buf s.server_version;
+ buf_int64 buf s.server_max_users;
+ buf_int64 buf s.server_lowid_users;
+ buf_int64 buf s.server_soft_limit;
+ buf_int64 buf s.server_hard_limit;
+ buf_int buf s.server_ping;
+ end
let buf_client proto buf c =
buf_int buf c.client_num;
Index: mldonkey/src/daemon/common/guiProto.ml
diff -u mldonkey/src/daemon/common/guiProto.ml:1.23
mldonkey/src/daemon/common/guiProto.ml:1.24
--- mldonkey/src/daemon/common/guiProto.ml:1.23 Mon Jan 9 00:22:35 2006
+++ mldonkey/src/daemon/common/guiProto.ml Mon Jan 16 16:05:14 2006
@@ -31,7 +31,7 @@
let to_gui_last_opcode = 58
let from_gui_last_opcode = 67
-let best_gui_version = 39
+let best_gui_version = 40
(* I will try to report all changes to the protocol here: send me patches
if I don't !
Index: mldonkey/src/daemon/common/guiTypes.ml
diff -u mldonkey/src/daemon/common/guiTypes.ml:1.25
mldonkey/src/daemon/common/guiTypes.ml:1.26
--- mldonkey/src/daemon/common/guiTypes.ml:1.25 Thu Jan 12 08:57:58 2006
+++ mldonkey/src/daemon/common/guiTypes.ml Mon Jan 16 16:05:14 2006
@@ -173,6 +173,12 @@
mutable server_banner : string;
mutable server_preferred : bool;
mutable server_version : string;
+ mutable server_max_users : int64;
+ mutable server_soft_limit : int64;
+ mutable server_hard_limit : int64;
+ mutable server_lowid_users : int64;
+ mutable server_ping : int;
+
}
type room_info = {
Index: mldonkey/src/networks/bittorrent/bTInteractive.ml
diff -u mldonkey/src/networks/bittorrent/bTInteractive.ml:1.77
mldonkey/src/networks/bittorrent/bTInteractive.ml:1.78
--- mldonkey/src/networks/bittorrent/bTInteractive.ml:1.77 Sat Jan 14
22:08:05 2006
+++ mldonkey/src/networks/bittorrent/bTInteractive.ml Mon Jan 16 16:05:14 2006
@@ -391,22 +391,12 @@
let last_seen = match file.file_swarmer with
None -> [| last_time () |]
| Some swarmer -> Int64Swarmer.compute_last_seen swarmer in
- {
- P.file_fields = P.Fields_file_info.all;
- P.file_comment = file_comment (as_file file);
+ { (impl_file_info file.file_file) with
+
P.file_name = file.file_name;
- P.file_num = (file_num file);
P.file_network = network.network_num;
P.file_names = [file.file_name, P.noips()];
- P.file_md4 = Md4.null;
- P.file_size = file_size file;
- P.file_downloaded = file_downloaded file;
- P.file_all_sources = 0;
- P.file_active_sources = 0;
- P.file_state = file_state file;
- P.file_sources = None;
- P.file_download_rate = file_download_rate file.file_file;
P.file_chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
Int64Swarmer.verified_bitmap swarmer);
@@ -414,11 +404,8 @@
[network.network_num,(match file.file_swarmer with
None -> "" | Some swarmer ->
Int64Swarmer.availability swarmer)];
- P.file_format = FormatNotComputed 0;
+
P.file_chunks_age = last_seen;
- P.file_age = file_age file;
- P.file_last_seen = file.file_file.impl_file_last_seen;
- P.file_priority = file_priority (as_file file);
P.file_uids = [Uid.create (BTUrl file.file_id)];
P.file_sub_files = file.file_files;
}
@@ -707,27 +694,19 @@
let op_client_info c =
let module P = GuiTypes in
let (ip,port) = c.client_host in
- {
+ { (impl_client_info c.client_client) with
+
P.client_network = network.network_num;
P.client_kind = Known_location (ip,port);
P.client_state = client_state (as_client c);
P.client_type = client_type c;
- P.client_tags = [];
- P.client_name =
- (Printf.sprintf "%s:%d" (Ip.to_string ip) port);
- P.client_files = None;
- P.client_num = (client_num c);
- P.client_rating = 0;
- P.client_chat_port = 0 ;
- P.client_connect_time = BasicSocket.last_time ();
+ P.client_name = (Printf.sprintf "%s:%d" (Ip.to_string ip) port);
P.client_software = (brand_to_string c.client_brand);
P.client_release = c.client_release;
- P.client_emulemod = "";
P.client_downloaded = c.client_downloaded;
P.client_uploaded = c.client_uploaded;
P.client_upload = Some (c.client_file.file_name);
- P.client_sui_verified = None;
-(* P.client_sock_addr = (Ip.to_string ip); *)
+
}
let op_client_connect c =
Index: mldonkey/src/networks/donkey/donkeyClient.ml
diff -u mldonkey/src/networks/donkey/donkeyClient.ml:1.80
mldonkey/src/networks/donkey/donkeyClient.ml:1.81
--- mldonkey/src/networks/donkey/donkeyClient.ml:1.80 Thu Jan 12 09:03:11 2006
+++ mldonkey/src/networks/donkey/donkeyClient.ml Mon Jan 16 16:05:14 2006
@@ -161,7 +161,7 @@
end;
if !verbose then
lprintf_nl () "warning no. %d, connecting too fast (last connect
%d sec. ago): %s"
- record.nwarnings old_time (full_client_identifier c);
+ record.nwarnings old_time (full_client_identifier c);
if !!send_warning_messages then
client_send c ( M.SayReq (
"[AUTOMATED WARNING] Your client is connecting too fast, it
will get banned"))
@@ -245,19 +245,19 @@
c.client_source.DonkeySources.source_sock <- NoConnection
| Connection sock ->
(try
- let log_print cc =
+ let log_print cc =
lprintf_nl () "Client[%d] %s disconnected, connected %s%s%s"
- (client_num cc)
- (full_client_identifier cc)
- (Date.time_to_string (last_time () - cc.client_connect_time)
"verbose")
- (if cc.client_uploaded > 0L then
- Printf.sprintf ", send %s" (size_of_int64 cc.client_uploaded)
else "")
- (if cc.client_downloaded > 0L then
- Printf.sprintf ", rec %s" (size_of_int64 cc.client_downloaded)
else "")
- in
- if c.client_debug ||
- (!verbose && (c.client_uploaded > 0L || c.client_downloaded > 0L))
then
- log_print c;
+ (client_num cc)
+ (full_client_identifier cc)
+ (Date.time_to_string (last_time () - cc.client_connect_time) "verbose")
+ (if cc.client_uploaded > 0L then
+ Printf.sprintf ", send %s" (size_of_int64 cc.client_uploaded) else "")
+ (if cc.client_downloaded > 0L then
+ Printf.sprintf ", rec %s" (size_of_int64 cc.client_downloaded) else "")
+ in
+ if c.client_debug ||
+ (!verbose && (c.client_uploaded > 0L || c.client_downloaded > 0L)) then
+ log_print c;
c.client_comp <- None;
(try if c.client_checked then count_seen c with _ -> ());
@@ -891,13 +891,13 @@
else
if Bitv.length chunks <> file.file_nchunks then begin
if !verbose then
- lprintf_nl () "number of chunks is different %d/%d for %s(%s), size
%Ld on %s"
+ lprintf_nl () "number of chunks is different %d/%d for %s(%s), size %Ld
on %s"
(Bitv.length chunks)
file.file_nchunks
- (file_best_name file)
+ (file_best_name file)
(Md4.to_string file.file_md4)
(file_size file)
- (full_client_identifier c);
+ (full_client_identifier c);
Bitv.create file.file_nchunks false
(* What should we do ?
@@ -1452,12 +1452,12 @@
let file = find_file t.Q.md4 in
received_client_bitmap c file t.Q.chunks
with e ->
- client_send c (M.NoSuchFileReq t.Q.md4);
- if !verbose then lprintf_nl ()
- "QueryChunksReply: Client (%s) asked for file_md4 %s, Exception
%s"
- (full_client_identifier c)
- (Md4.to_string t.Q.md4)
- (Printexc2.to_string e)
+ client_send c (M.NoSuchFileReq t.Q.md4);
+ if !verbose then lprintf_nl ()
+ "QueryChunksReply: Client (%s) asked for file_md4 %s, Exception %s"
+ (full_client_identifier c)
+ (Md4.to_string t.Q.md4)
+ (Printexc2.to_string e)
end
| M.QueryChunkMd4ReplyReq t ->
@@ -1473,7 +1473,7 @@
if file.file_computed_md4s = [||] then begin
if file.file_nchunks = 1 then begin
lprintf_nl () "[ERROR] file %s has only one chunk, ignoring
QueryChunkMd4ReplyReq"
- (file_best_name file);
+ (file_best_name file);
file.file_computed_md4s <- [|file.file_md4|];
match file.file_swarmer with
None -> ()
@@ -1483,17 +1483,17 @@
end else
if t.Q.chunks = [||] then
lprintf_nl () "[ERROR] received empty chunks md4 message for %s
from %s"
- (file_best_name file) (full_client_identifier c)
+ (file_best_name file) (full_client_identifier c)
else
if Array.length t.Q.chunks <> file.file_nchunks then begin
if !verbose then
- lprintf_nl () "[ERROR] number of chunks does not match, received
md4s %d/should be %d, for %s(%s):%Ld bytes from %s"
- (Array.length t.Q.chunks)
- file.file_nchunks
- (file_best_name file)
- (Md4.to_string file.file_md4)
- (file_size file)
- (full_client_identifier c)
+ lprintf_nl () "[ERROR] number of chunks does not match, received md4s
%d/should be %d, for %s(%s):%Ld bytes from %s"
+ (Array.length t.Q.chunks)
+ file.file_nchunks
+ (file_best_name file)
+ (Md4.to_string file.file_md4)
+ (file_size file)
+ (full_client_identifier c)
(* What should we do ?
1) Try to recover the correct size of the file: we can use
@@ -1513,7 +1513,7 @@
let md4 = DonkeyShare.md4_of_array md4s in
if md4 <> file.file_md4 then begin
lprintf_nl () "[ERROR] Chunks md4s do not match file_md4 for
%s(%s) from %s"
- (file_best_name file) (Md4.to_string file.file_md4)
(full_client_identifier c);
+ (file_best_name file) (Md4.to_string file.file_md4)
(full_client_identifier c);
end else begin
file.file_computed_md4s <- md4s;
match file.file_swarmer with
@@ -1585,7 +1585,7 @@
if comp.comp_len > comp.comp_total then begin
if !verbose_unknown_messages then
lprintf_nl () "eMule compressed data, ignoring, more data (%d)
than compressed (%d) from %s for %s"
- comp.comp_len comp.comp_total (full_client_identifier c)
(Md4.to_string comp.comp_md4);
+ comp.comp_len comp.comp_total (full_client_identifier c)
(Md4.to_string comp.comp_md4);
c.client_comp <- None;
end
@@ -1689,7 +1689,7 @@
client_send c (M.NoSuchFileReq md4);
if !verbose_unexpected_messages then
lprintf_nl () "donkeyClient: QueryFileReq: Client %s queried
unpublished file %s"
- (full_client_identifier c) (Md4.to_string md4)
+ (full_client_identifier c) (Md4.to_string md4)
| e ->
lprintf_nl () "Exception %s in QueryFileReq"
(Printexc.to_string e)
@@ -2428,7 +2428,7 @@
lprintf_nl () "incoming connection from %s:%d %s: (%d/%d)%s"
s_from_ip from_port
(if accept_connection then "accepted" else
- if is_ip_blocked then "blocked" else "denied")
+ if is_ip_blocked then "blocked" else "denied")
!DonkeySources.indirect_connections
!real_max_indirect_connections
(if is_connecting_server then
@@ -2436,7 +2436,7 @@
let s = Hashtbl.find servers_by_key from_ip in
Printf.sprintf " %s (%s)" s.server_name (Ip.to_string
s.server_ip)
with _ ->
- try
+ try
let s = Hashtbl.find servers_by_key connecting_server in
Printf.sprintf " %s (%s)" s.server_name (Ip.to_string
s.server_ip)
with _ -> "Unknown server"
@@ -2601,5 +2601,5 @@
with e ->
if !verbose then
lprintf_nl () "remove_location for file_md4 %s: exception %s"
- file_uid (Printexc2.to_string e)
+ file_uid (Printexc2.to_string e)
)
Index: mldonkey/src/networks/donkey/donkeyGlobals.ml
diff -u mldonkey/src/networks/donkey/donkeyGlobals.ml:1.71
mldonkey/src/networks/donkey/donkeyGlobals.ml:1.72
--- mldonkey/src/networks/donkey/donkeyGlobals.ml:1.71 Thu Jan 12 09:03:11 2006
+++ mldonkey/src/networks/donkey/donkeyGlobals.ml Mon Jan 16 16:05:14 2006
@@ -480,10 +480,8 @@
server_tags = [];
server_nfiles = Int64.zero;
server_nusers = Int64.zero;
- server_max_users = 0;
server_name = "";
server_description = "";
- server_version = "";
server_banner = "";
server_users = [];
server_master = false;
@@ -495,6 +493,14 @@
server_id_requests = Fifo.create ();
server_flags = 0;
server_has_zlib = false;
+ server_version = "";
+ server_lowid_users = 0L;
+ server_soft_limit = 0L;
+ server_hard_limit = 0L;
+ server_max_users = 0L;
+ server_last_ping = 0.;
+ server_ping = 0;
+
}
and server_impl =
{
Index: mldonkey/src/networks/donkey/donkeyInteractive.ml
diff -u mldonkey/src/networks/donkey/donkeyInteractive.ml:1.84
mldonkey/src/networks/donkey/donkeyInteractive.ml:1.85
--- mldonkey/src/networks/donkey/donkeyInteractive.ml:1.84 Thu Jan 12
08:57:58 2006
+++ mldonkey/src/networks/donkey/donkeyInteractive.ml Mon Jan 16 16:05:14 2006
@@ -1033,36 +1033,27 @@
| Some swarmer -> Int64Swarmer.compute_last_seen swarmer
in
let v =
- {
- P.file_fields = Fields_file_info.all;
+ { (impl_file_info file.file_file) with
- P.file_comment = file_comment (as_file file);
- P.file_name = file_best_name file;
- P.file_num = (file_num file);
P.file_network = network.network_num;
P.file_names = file.file_filenames;
P.file_md4 = file.file_md4;
- P.file_size = file_size file;
- P.file_downloaded = file_downloaded file;
P.file_all_sources =
file.file_sources.DonkeySources.manager_all_sources;
P.file_active_sources =
file.file_sources.DonkeySources.manager_active_sources;
- P.file_state = file_state file;
- P.file_sources = None;
- P.file_download_rate = file_download_rate file.file_file;
- P.file_chunks = (match file.file_swarmer with
- None -> "" | Some swarmer ->
- Int64Swarmer.verified_bitmap swarmer);
- P.file_priority = file_priority file;
+ P.file_chunks =
+ (match file.file_swarmer with
+ | None -> ""
+ | Some swarmer -> Int64Swarmer.verified_bitmap swarmer);
P.file_availability =
- [network.network_num,(match file.file_swarmer with
- None -> "" | Some swarmer ->
- Int64Swarmer.availability swarmer)];
+ [
+ network.network_num,
+ (match file.file_swarmer with
+ | None -> ""
+ | Some swarmer -> Int64Swarmer.availability swarmer)
+ ];
P.file_format = file.file_format;
P.file_chunks_age = last_seen;
- P.file_age = file_age file;
- P.file_last_seen = file.file_file.impl_file_last_seen;
P.file_uids = [Uid.create (Ed2k file.file_md4)];
- P.file_sub_files = [];
} in
v
with e ->
@@ -1074,23 +1065,26 @@
let _ =
server_ops.op_server_info <- (fun s ->
if !!enable_donkey then
- {
- P.server_num = (server_num s);
+ { (impl_server_info s.server_server) with
+
P.server_network = network.network_num;
P.server_addr = Ip.addr_of_ip s.server_ip;
P.server_port = s.server_port;
P.server_realport = (match s.server_realport with Some x -> x | None
-> 0);
P.server_score = s.server_score;
- P.server_tags = []; (* s.server_tags; *)
P.server_nusers = s.server_nusers;
P.server_nfiles = s.server_nfiles;
- P.server_state = server_state s;
P.server_name = s.server_name;
P.server_description = s.server_description;
P.server_banner = s.server_banner;
- P.server_users = None;
P.server_preferred = s.server_preferred;
P.server_version = s.server_version;
+ P.server_max_users = s.server_max_users;
+ P.server_soft_limit = s.server_soft_limit;
+ P.server_hard_limit = s.server_hard_limit;
+ P.server_lowid_users = s.server_lowid_users;
+ P.server_ping = s.server_ping;
+
}
else raise Not_found
)
@@ -1130,7 +1124,8 @@
let _ =
client_ops.op_client_info <- (fun c ->
- {
+ { (impl_client_info c.client_client) with
+
P.client_network = network.network_num;
P.client_kind = (match c.client_kind with
Direct_address (ip, port) -> Known_location (ip,port)
@@ -1139,12 +1134,8 @@
| _ -> Indirect_location (c.client_name,c.client_md4, Ip.null, 0));
P.client_state = client_state c;
P.client_type = client_type c;
- P.client_tags = []; (* c.client_tags; *)
P.client_name = c.client_name;
- P.client_files = None;
- P.client_num = (client_num c);
P.client_rating = c.client_rating;
- P.client_chat_port = 0 ;
P.client_connect_time = c.client_connect_time;
P.client_software = brand_to_string_short c.client_brand;
P.client_release = c.client_emule_proto.emule_release;
Index: mldonkey/src/networks/donkey/donkeyProtoCom.ml
diff -u mldonkey/src/networks/donkey/donkeyProtoCom.ml:1.27
mldonkey/src/networks/donkey/donkeyProtoCom.ml:1.28
--- mldonkey/src/networks/donkey/donkeyProtoCom.ml:1.27 Mon Jan 9 00:22:35 2006
+++ mldonkey/src/networks/donkey/donkeyProtoCom.ml Mon Jan 16 16:05:14 2006
@@ -166,21 +166,25 @@
done
with Not_found -> ()
-let udp_send t ip port msg =
+let really_udp_send t ip port msg isping =
if !verbose_udp then begin
- lprintf_nl () "Message UDP to %s:%d\n%s" (Ip.to_string ip) port
- (DonkeyProtoUdp.print msg);
+ lprintf_nl () "Message UDP%s to %s:%d\n%s"
+ (if isping then "(PING)" else "") (Ip.to_string ip)
+ port (DonkeyProtoUdp.print msg);
end;
try
Buffer.reset buf;
DonkeyProtoUdp.write buf msg;
let s = Buffer.contents buf in
- UdpSocket.write t false s ip port
+ UdpSocket.write t isping s ip port
with e ->
lprintf_nl () "Exception %s in udp_send" (Printexc2.to_string e)
+let udp_send t ip port msg =
+ really_udp_send t ip port msg false
+
let udp_handler f sock event =
let module M = DonkeyProtoUdp in
match event with
@@ -396,3 +400,6 @@
let udp_server_send s t =
udp_send (get_udp_sock ()) s.server_ip (s.server_port+4) t
+
+let udp_server_send_ping s t =
+ really_udp_send (get_udp_sock ()) s.server_ip (s.server_port+4) t true
Index: mldonkey/src/networks/donkey/donkeyProtoCom.mli
diff -u mldonkey/src/networks/donkey/donkeyProtoCom.mli:1.5
mldonkey/src/networks/donkey/donkeyProtoCom.mli:1.6
--- mldonkey/src/networks/donkey/donkeyProtoCom.mli:1.5 Mon Aug 8 16:47:31 2005
+++ mldonkey/src/networks/donkey/donkeyProtoCom.mli Mon Jan 16 16:05:14 2006
@@ -78,3 +78,4 @@
val tag_file : file -> CommonTypes.tag list
val udp_server_send : server -> DonkeyProtoUdp.t -> unit
+val udp_server_send_ping : server -> DonkeyProtoUdp.t -> unit
Index: mldonkey/src/networks/donkey/donkeyProtoUdp.ml
diff -u mldonkey/src/networks/donkey/donkeyProtoUdp.ml:1.13
mldonkey/src/networks/donkey/donkeyProtoUdp.ml:1.14
--- mldonkey/src/networks/donkey/donkeyProtoUdp.ml:1.13 Sat Sep 17 17:50:38 2005
+++ mldonkey/src/networks/donkey/donkeyProtoUdp.ml Mon Jan 16 16:05:14 2006
@@ -28,6 +28,7 @@
open DonkeyTypes
open DonkeyMftp
+open Int64ops
module QueryReplyUdp = struct
@@ -50,31 +51,31 @@
let parse len s =
let rec iter pos list =
- if pos < len then
+ if pos < len then
let file, pos = get_file s pos in
let pos = pos + 2 in
- iter pos (file :: list)
- else List.rev list
+ iter pos (file :: list)
+ else List.rev list
in
iter 1 []
let bprint oc t =
Printf.bprintf oc "FOUND:\n";
List.iter (fun t ->
- Printf.bprintf oc "%s\n" (Md4.to_string t.f_md4);
- Printf.bprintf oc "%s\n" (Ip.to_string t.f_ip);
- Printf.bprintf oc "%d\n" t.f_port;
- Printf.bprintf oc "TAGS:\n";
- bprint_tags oc t.f_tags;
+ Printf.bprintf oc "%s\n" (Md4.to_string t.f_md4);
+ Printf.bprintf oc "%s\n" (Ip.to_string t.f_ip);
+ Printf.bprintf oc "%d\n" t.f_port;
+ Printf.bprintf oc "TAGS:\n";
+ bprint_tags oc t.f_tags;
Printf.bprintf oc "\n"
) t
let write buf t =
List.iter (fun file ->
- buf_md4 buf file.f_md4;
- buf_ip buf file.f_ip;
- buf_port buf file.f_port;
- buf_tags buf file.f_tags names_of_tag
+ buf_md4 buf file.f_md4;
+ buf_ip buf file.f_ip;
+ buf_port buf file.f_port;
+ buf_tags buf file.f_tags names_of_tag
) t
end
@@ -108,9 +109,8 @@
let parse len s =
try
- get_uint64_32 s 1(*, get_int8 s 2, get_int8 s 3*)
- with _ ->
- Int64.zero
+ get_uint64_32 s 1 (*, get_int8 s 2, get_int8 s 3*)
+ with _ -> 0L
let bprint oc t =
Printf.bprintf oc "PING %s\n" (Int64.to_string t)
@@ -136,22 +136,25 @@
type t = {
challenge : int64;
- users : int;
- files : int;
- soft_limit : int option;
- hard_limit : int option;
- max_users : int option;
+ users : int64;
+ files : int64;
+ soft_limit : int64 option;
+ hard_limit : int64 option;
+ max_users : int64 option;
flags : int option;
+ lowid_users : int64 option;
}
(* <E3><97><users><files><softLimit><hardLimit><maxUsers><flags> *)
let parse len s =
let challenge = get_uint64_32 s 1 in
- let users = get_int s 5 in
- let files = get_int s 9 in
- let max_users = if len >= 16 then Some (get_int s 13) else None in
- let soft_limit = if len >= 20 then Some (get_int s 17) else None in
- let hard_limit = if len >= 24 then Some (get_int s 21) else None in
- let flags = if len >= 28 then Some (get_int s 25) else None in
+ let users = get_uint64_32 s 5 in
+ let files = get_uint64_32 s 9 in
+ let max_users = if len >= 17 then Some (get_uint64_32 s 13) else None in
+ let soft_limit = if len >= 21 then Some (get_uint64_32 s 17) else None in
+ let hard_limit = if len >= 25 then Some (get_uint64_32 s 21) else None in
+ let flags = if len >= 29 then Some (get_int s 25) else None in
+ let lowid_users = if len >= 33 then Some (get_uint64_32 s 29) else None
in
+
{
challenge = challenge;
users = users;
@@ -160,30 +163,31 @@
hard_limit = hard_limit;
max_users = max_users;
flags = flags;
+ lowid_users = lowid_users;
}
let bprint oc t =
Printf.bprintf oc "PING REPLY\n";
- Printf.bprintf oc " %d users %d files\n" t.users t.files;
- (match t.soft_limit with Some x -> Printf.bprintf oc " Soft limit:
%d\n" x | None -> ());
- (match t.hard_limit with Some x -> Printf.bprintf oc " Hard limit:
%d\n" x | None -> ());
- (match t.max_users with Some x -> Printf.bprintf oc " Max nusers:
%d\n" x | None -> ());
+ Printf.bprintf oc " %Ld users %Ld files\n" t.users t.files;
+ (match t.soft_limit with Some x -> Printf.bprintf oc " Soft limit:
%Ld\n" x | None -> ());
+ (match t.hard_limit with Some x -> Printf.bprintf oc " Hard limit:
%Ld\n" x | None -> ());
+ (match t.max_users with Some x -> Printf.bprintf oc " Max nusers:
%Ld\n" x | None -> ());
(match t.flags with Some x -> Printf.bprintf oc " Flags: %x\n" x |
None -> ());
Printf.bprintf oc "\n"
let write buf t =
buf_int64_32 buf t.challenge;
- buf_int buf t.users;
- buf_int buf t.files;
+ buf_int64_32 buf t.users;
+ buf_int64_32 buf t.files;
(match t.soft_limit, t.hard_limit, t.max_users, t.flags with
None, None, None, None -> ()
| _ ->
- buf_int buf (
- match t.soft_limit with Some x -> x | None -> 0);
- buf_int buf (
- match t.hard_limit with Some x -> x | None -> 0);
- buf_int buf (
- match t.max_users with Some x -> x | None -> 0);
+ buf_int64_32 buf (
+ match t.soft_limit with Some x -> x | None -> 0L);
+ buf_int64_32 buf (
+ match t.hard_limit with Some x -> x | None -> 0L);
+ buf_int64_32 buf (
+ match t.max_users with Some x -> x | None -> 0L);
match t.flags with Some x -> buf_int buf x | None -> ()
)
end
@@ -193,22 +197,33 @@
ip : Ip.t;
}
+ let invalid_len = Int64.of_int 0xF0FF
+
let parse len s =
try
let ip = get_ip s 1 in
- {
- ip = ip
- }
+ {
+ ip = ip
+ }
with _ ->
{
- ip = Ip.null
+ ip = Ip.null
}
let bprint b t =
Printf.bprintf b "ServerDescUdpReq %s\n" (Ip.to_string t.ip)
+(*
+// eserver 16.45+ supports a new OP_SERVER_DESC_RES answer, if the
OP_SERVER_DESC_REQ contains a uint32
+// challenge, the server returns additional info with OP_SERVER_DESC_RES. To
properly distinguish the
+// old and new OP_SERVER_DESC_RES answer, the challenge has to be selected
carefully. The first 2 bytes
+// of the challenge (in network byte order) MUST NOT be a valid
string-len-int16!
+*)
+
let write buf t =
- buf_ip buf t.ip
+ let rand16 = Int64.of_int (Random.int 65535) in
+ let challenge = (left64 rand16 16) ++ invalid_len in
+ buf_int64_32 buf challenge
end
@@ -216,16 +231,52 @@
type t = {
name : string;
desc : string;
+ tags : tag list;
}
- let parse len s =
+
+ let names_of_tag = [
+ "\001", Field_UNKNOWN "servername";
+ "\011", Field_UNKNOWN "description";
+ "\012", Field_UNKNOWN "ping";
+ "\013", Field_UNKNOWN "fail";
+ "\014", Field_UNKNOWN "preference";
+ "\015", Field_UNKNOWN "port";
+ "\016", Field_UNKNOWN "ip";
+ "\133", Field_UNKNOWN "dynip";
+ "\135", Field_UNKNOWN "maxusers";
+ "\136", Field_UNKNOWN "softfiles";
+ "\137", Field_UNKNOWN "hardfiles";
+ "\144", Field_UNKNOWN "lastping";
+ "\145", Field_UNKNOWN "version";
+ "\146", Field_UNKNOWN "udpflags";
+ "\147", Field_UNKNOWN "auxportslist";
+ "\148", Field_UNKNOWN "lowidusers";
+ ]
+
+ let parse1 len s =
let name, pos = get_string s 1 in
let desc, pos = get_string s pos in
{
+ tags = [];
name = name;
desc = desc;
}
+ let parse2 len s =
+ let stags,pos = get_tags s 5 names_of_tag in
+ {
+ tags = stags;
+ name = "";
+ desc = "";
+ }
+
+ let parse len s =
+ let challenge = get_uint64_32 s 1 in
+ let test = right64 (left64 challenge 48) 48 in
+ let f = if test = ServerDescUdp.invalid_len then parse2 else parse1 in
+ f len s
+
let bprint b t =
Printf.bprintf b "ServerDescReplyUdpReq\n";
Printf.bprintf b "name : %s\n" t.name;
@@ -245,14 +296,14 @@
let parse len s =
try
let ip = get_ip s 1 in
- {
- ip = ip;
- }
+ {
+ ip = ip;
+ }
with _ ->
{
- ip = Ip.null
+ ip = Ip.null
}
-
+
let bprint b t =
Printf.bprintf b "ServerListUdp %s\n" (Ip.to_string t.ip)
@@ -271,9 +322,9 @@
let parse len s =
let rec iter pos list =
if pos < len then
- iter (pos+16) (get_md4 s pos :: list)
+ iter (pos+16) (get_md4 s pos :: list)
else
- List.rev list
+ List.rev list
in
iter 1 []
@@ -361,8 +412,8 @@
let parse len s =
let rec iter list pos =
if len > pos then
- let t, pos = parse_query s pos in
- iter (t :: list) pos
+ let t, pos = parse_query s pos in
+ iter (t :: list) pos
else List.rev list
in
iter [] 1
Index: mldonkey/src/networks/donkey/donkeyServers.ml
diff -u mldonkey/src/networks/donkey/donkeyServers.ml:1.50
mldonkey/src/networks/donkey/donkeyServers.ml:1.51
--- mldonkey/src/networks/donkey/donkeyServers.ml:1.50 Sun Jan 15 15:45:53 2006
+++ mldonkey/src/networks/donkey/donkeyServers.ml Mon Jan 16 16:05:14 2006
@@ -273,7 +273,7 @@
disconnect_server s (Closed_for_error "Low ID")
else begin
s.server_cid <- Some t.M.SetID.ip;
- s.server_realport <- t.M.SetID.port;
+ s.server_realport <- t.M.SetID.port;
(* disconnect after (connected_server_timeout) seconds of silence *)
set_rtimeout sock !!connected_server_timeout;
set_server_state s Connected_initiating;
@@ -292,19 +292,21 @@
| M.MessageReq msg ->
- (try
- let prefix = String.sub msg 0 15 in
- if prefix = "server version " then begin
- s.server_version <- String.sub msg 15 4;
- end;
- with _-> ());
+ (* This is stupid *)
+ if s.server_version = "" then begin
+ try
+ let prefix = String.sub msg 0 15 in
+ if prefix = "server version " then
+ s.server_version <- String.sub msg 15 4
+ with _ -> ()
+ end;
if !last_message_sender <> server_num s then begin
let server_header = Printf.sprintf "\n+-- From server %s [%s:%d]
------"
s.server_name (Ip.to_string s.server_ip) s.server_port in
CommonEvent.add_event (Console_message_event (Printf.sprintf "%s\n"
server_header));
if !CommonOptions.verbose_msg_servers then
- lprintf_nl () "%s" server_header;
+ lprintf_nl () "%s" server_header;
last_message_sender := server_num s
end;
s.server_banner <- s.server_banner ^ Printf.sprintf "%s\n" msg;
@@ -529,7 +531,7 @@
(* lprintf "connect_one_server\n"; *)
if can_open_connection connection_manager then
match !servers_list with
- [] ->
+ [] ->
if restart then begin
servers_list := [];
Hashtbl.iter (fun _ s ->
@@ -542,7 +544,7 @@
lprintf_nl () "Please import servers from a server.met file.";
lprintf_nl () "Let MLDonkey use a file configured in
web_infos";
lprintf_nl () "or enter this link into MLDonkey:";
- lprintf_nl ()
"ed2k://|serverlist|http://www.gruk.org/server.met.gz|/"
+ lprintf_nl () "ed2k://|serverlist|http://www.gruk.org/server.met.gz|/"
end;
raise Not_found;
@@ -716,7 +718,6 @@
7 packets/second = 7 * 40 bytes = 280 B/s ...
*)
-let udp_ping = String.create 6
let udp_walker_timer () =
match !udp_walker_list with
@@ -729,8 +730,19 @@
end
| s :: tail ->
udp_walker_list := tail;
- UdpSocket.write (get_udp_sock ())
- true udp_ping s.server_ip (s.server_port + 4)
+ let c = Int64.of_int (Random.int 65535) in
+ let challenge = 1437204480L ++ c in (* 0x55AA0000 *)
+ s.server_last_ping <- Unix.gettimeofday ();
+ udp_server_send_ping s (DonkeyProtoUdp.PingServerUdpReq challenge);
+
+ let module M = DonkeyProtoUdp in
+ let module E = M.ServerDescUdp in
+ udp_server_send s (M.ServerDescUdpReq {
+ E.ip = Ip.null;
+ })
+
+(* UdpSocket.write (get_udp_sock ())
+ true udp_ping s.server_ip (s.server_port + 4) *)
(* sort the servers by preferred first
then users count with decreasing order
@@ -755,13 +767,13 @@
match s.server_sock with
| Connection _ ->
if !verbose_location then begin
- if !tag2 then begin
+ if !tag2 then begin
lprintf_n () "master servers (old):";
- tag1 := false;
- tag2 := false
- end;
- lprintf " %s" (Ip.to_string s.server_ip)
- end;
+ tag1 := false;
+ tag2 := false
+ end;
+ lprintf " %s" (Ip.to_string s.server_ip)
+ end;
masters := s :: !masters
| _ -> s.server_master <- false
) server_list;
@@ -812,7 +824,7 @@
in
if !verbose_location then
lprintf_nl () "master servers: Checking ip:%s, users: %Ld, ct:%d"
- (Ip.to_string s.server_ip) s.server_nusers connection_time;
+ (Ip.to_string s.server_ip) s.server_nusers connection_time;
if not s.server_master
&& (s.server_preferred
|| connection_time > !!become_master_delay
@@ -863,13 +875,6 @@
open LittleEndian
let _ =
- udp_ping.[0] <- char_of_int 0xe3;
- udp_ping.[1] <- char_of_int 0x96;
- udp_ping.[2] <- char_of_int (Random.int 256);
- udp_ping.[3] <- char_of_int (Random.int 256);
- udp_ping.[4] <- char_of_int 0xAA;
- udp_ping.[5] <- char_of_int 0x55;
-
CommonWeb.add_redirector_info "DKSV" (fun buf ->
buf_list (fun buf s ->
buf_ip buf s.server_ip;
Index: mldonkey/src/networks/donkey/donkeyTypes.ml
diff -u mldonkey/src/networks/donkey/donkeyTypes.ml:1.36
mldonkey/src/networks/donkey/donkeyTypes.ml:1.37
--- mldonkey/src/networks/donkey/donkeyTypes.ml:1.36 Thu Jan 12 08:57:58 2006
+++ mldonkey/src/networks/donkey/donkeyTypes.ml Mon Jan 16 16:05:14 2006
@@ -545,10 +545,8 @@
mutable server_tags : CommonTypes.tag list;
mutable server_nusers : int64;
mutable server_nfiles : int64;
- mutable server_max_users : int;
mutable server_name : string;
mutable server_description : string;
- mutable server_version : string;
mutable server_banner : string;
mutable server_users: user list;
mutable server_next_udp : int;
@@ -556,6 +554,9 @@
mutable server_preferred : bool;
mutable server_last_message : int; (* used only by mldonkey server *)
+ mutable server_last_ping : float;
+ mutable server_ping : int;
+
mutable server_id_requests : file option Fifo.t;
mutable server_queries_credit : int;
@@ -564,6 +565,11 @@
mutable server_has_zlib : bool;
mutable server_flags : int;
+ mutable server_version : string;
+ mutable server_lowid_users : int64;
+ mutable server_soft_limit : int64;
+ mutable server_hard_limit : int64;
+ mutable server_max_users : int64;
}
Index: mldonkey/src/networks/donkey/donkeyUdp.ml
diff -u mldonkey/src/networks/donkey/donkeyUdp.ml:1.20
mldonkey/src/networks/donkey/donkeyUdp.ml:1.21
--- mldonkey/src/networks/donkey/donkeyUdp.ml:1.20 Sat Sep 17 17:59:47 2005
+++ mldonkey/src/networks/donkey/donkeyUdp.ml Mon Jan 16 16:05:14 2006
@@ -100,7 +100,7 @@
if server_send_multiple_replies s then
Udp.QueryUdpReq ss.search_query
- else *)
+ else *)
Udp.QueryMultipleUdpReq ss.search_query);
) before;
@@ -121,7 +121,7 @@
let files = ref [] in
List.iter (fun file ->
if file_state file = FileDownloading then
- files := file :: !files) !current_files;
+ files := file :: !files) !current_files;
if !files <> [] then
@@ -131,23 +131,23 @@
while !nservers < !!max_udp_sends &&
match !udp_servers_list with
- [] -> false
+ [] -> false
| s :: tail ->
- udp_servers_list := tail;
+ udp_servers_list := tail;
(match s.server_sock with
Connection _ -> ()
| _ ->
- if
- connection_last_conn s.server_connection_control + 3600*8 >
last_time () &&
- s.server_next_udp <= last_time () then begin
- (if server_accept_multiple_getsources s then
- new_servers := s :: !new_servers
- else
- old_servers := s :: !old_servers);
- incr nservers;
- end
+ if
+ connection_last_conn s.server_connection_control + 3600*8 > last_time () &&
+ s.server_next_udp <= last_time () then begin
+ (if server_accept_multiple_getsources s then
+ new_servers := s :: !new_servers
+ else
+ old_servers := s :: !old_servers);
+ incr nservers;
+ end
);
- true do
+ true do
()
done;
@@ -155,15 +155,15 @@
let md4s = List.map (fun file -> file.file_md4) !files in
List.iter (fun s ->
- let module Udp = DonkeyProtoUdp in
- udp_server_send s (Udp.QueryLocationUdpReq md4s);
- s.server_next_udp <- last_time () + !!min_reask_delay
+ let module Udp = DonkeyProtoUdp in
+ udp_server_send s (Udp.QueryLocationUdpReq md4s);
+ s.server_next_udp <- last_time () + !!min_reask_delay
) !new_servers
end;
if !old_servers <> [] then
List.iter (fun file ->
- if file_state file = FileDownloading then begin
+ if file_state file = FileDownloading then begin
(*(* USELESS NOW *)
Intmap.iter (fun _ c ->
try connect_client !!client_ip [file] c with _ -> ())
@@ -186,13 +186,13 @@
match s.server_sock with
| Connection _ -> ()
| _ -> udp_query_locations file s
- ) !old_servers;
- end
+ ) !old_servers;
+ end
) !current_files;
List.iter (fun s ->
s.server_next_udp <- last_time () + !!min_reask_delay
- ) !old_servers;
+ ) !old_servers;
if !udp_servers_list = [] then
udp_servers_list := Hashtbl2.to_list servers_by_key;
@@ -242,10 +242,10 @@
| _ -> raise Not_found
in
match t with
- Udp.QueryLocationReplyUdpReq t ->
- (* lprintf "Received location by UDP\n"; *)
- let s = udp_from_server p in
- List.iter (query_locations_reply s) t
+ | Udp.QueryLocationReplyUdpReq t ->
+ (* lprintf "Received location by UDP\n"; *)
+ let s = udp_from_server p in
+ List.iter (query_locations_reply s) t
| Udp.QueryReplyUdpReq t ->
(* lprintf "Received file by UDP\n"; *)
@@ -261,15 +261,46 @@
let module M = Udp.PingServerReplyUdp in
let s = udp_from_server p in
UdpSocket.declare_pong s.server_ip;
+ let now = Unix.gettimeofday() in
+ s.server_ping <- int_of_float ((now -. s.server_last_ping) *. 1000.);
s.server_last_message <- last_time ();
- s.server_nfiles <- Int64.of_int t.M.files;
- s.server_nusers <- Int64.of_int t.M.users;
+ s.server_nfiles <- t.M.files;
+ s.server_nusers <- t.M.users;
(match t.M.max_users with
Some x -> s.server_max_users <- x
| None -> ());
(match t.M.flags with
Some x -> s.server_flags <- x
| None -> ());
+ (match t.M.lowid_users with
+ Some x -> s.server_lowid_users <- x
+ | None -> ());
+ (match t.M.soft_limit with
+ Some x -> s.server_soft_limit <- x
+ | None -> ());
+ (match t.M.hard_limit with
+ Some x -> s.server_hard_limit <- x
+ | None -> ());
+ server_must_update s
+
+ | Udp.ServerDescReplyUdpReq t ->
+ let module M = Udp.ServerDescReplyUdp in
+ let s = udp_from_server p in
+ List.iter (fun tag ->
+ match tag with
+ { tag_name = Field_UNKNOWN "version"; tag_value = Uint64 i } ->
+ let i = Int64.to_int i in
+ s.server_version <- Printf.sprintf "%d.%d" (i lsr 16) (i land
0xFFFF);
+ | { tag_name = Field_UNKNOWN "servername"; tag_value = String name
} ->
+ s.server_name <- name
+ | { tag_name = Field_UNKNOWN "description"; tag_value = String
desc } ->
+ s.server_description <- desc
+ | _ -> ()
+ ) t.M.tags;
+
+ if s.server_tags = [] then
+ s.server_tags <- t.M.tags;
+
server_must_update s
| Udp.EmuleReaskFilePingUdpReq t -> ()
Index: mldonkey/src/networks/gnutella/gnutellaInteractive.ml
diff -u mldonkey/src/networks/gnutella/gnutellaInteractive.ml:1.48
mldonkey/src/networks/gnutella/gnutellaInteractive.ml:1.49
--- mldonkey/src/networks/gnutella/gnutellaInteractive.ml:1.48 Thu Jan 12
08:57:58 2006
+++ mldonkey/src/networks/gnutella/gnutellaInteractive.ml Mon Jan 16
16:05:14 2006
@@ -282,22 +282,10 @@
file.file_swarmer <- None;
);
file_ops.op_file_info <- (fun file ->
- {
- P.file_fields = P.Fields_file_info.all;
-
- P.file_comment = file_comment (as_file file);
+ { (impl_file_info file.file_file) with
P.file_name = file.file_name;
- P.file_num = (file_num file);
P.file_network = network.network_num;
P.file_names = [file.file_name, P.noips()];
- P.file_md4 = Md4.null;
- P.file_size = file_size file;
- P.file_downloaded = file_downloaded file;
- P.file_all_sources = 0;
- P.file_active_sources = 0;
- P.file_state = file_state file;
- P.file_sources = None;
- P.file_download_rate = file_download_rate file.file_file;
P.file_chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
@@ -307,38 +295,26 @@
None -> "" | Some swarmer ->
Int64Swarmer.availability swarmer)];
- P.file_format = FormatNotComputed 0;
P.file_chunks_age = [|0|];
- P.file_age = file_age file;
P.file_last_seen = BasicSocket.last_time ();
- P.file_priority = file_priority (as_file file);
P.file_uids = file.file_uids;
- P.file_sub_files = [];
}
)
let _ =
server_ops.op_server_info <- (fun s ->
if !!enable_gnutella then
- {
- P.server_num = (server_num s);
+ { (impl_server_info s.server_server) with
+
P.server_network = network.network_num;
P.server_addr = s.server_host.host_addr;
P.server_port = s.server_host.host_port;
- P.server_realport = 0;
- P.server_score = 0;
- P.server_tags = [];
P.server_nusers = s.server_nusers;
P.server_nfiles = s.server_nfiles;
- P.server_state = server_state s;
P.server_name = s.server_agent;
- P.server_description = "";
- P.server_users = None;
- P.server_banner = "";
- P.server_preferred = false;
- P.server_version = "";
- } else
- raise Not_found
+
+ }
+ else raise Not_found
);
server_ops.op_server_connect <- (fun s ->
GnutellaServers.connect_server s.server_host);
@@ -419,28 +395,13 @@
let _ =
client_ops.op_client_info <- (fun c ->
- {
+ { (impl_client_info c.client_client) with
+
P.client_network = network.network_num;
P.client_kind = c.client_user.user_kind;
- P.client_state = client_state (as_client c);
P.client_type = client_type c;
- P.client_tags = [];
P.client_name = c.client_user.user_nick;
- P.client_files = None;
- P.client_num = (client_num (as_client c));
- P.client_rating = 0;
- P.client_chat_port = 0 ;
- P.client_connect_time = BasicSocket.last_time ();
- P.client_software = "";
- P.client_release = "";
- P.client_emulemod = "";
- P.client_downloaded = zero;
- P.client_uploaded = zero;
- P.client_upload = None;
- P.client_sui_verified = None;
-(* P.client_sock_addr = (match c.client_user.user_kind with
- | Known_location (ip,port) -> Ip.to_string ip
- | _ -> ""); *)
+
}
);
client_ops.op_client_browse <- (fun c immediate ->
Index: mldonkey/src/networks/opennap/opennapInteractive.ml
diff -u mldonkey/src/networks/opennap/opennapInteractive.ml:1.21
mldonkey/src/networks/opennap/opennapInteractive.ml:1.22
--- mldonkey/src/networks/opennap/opennapInteractive.ml:1.21 Mon Jan 9
00:22:36 2006
+++ mldonkey/src/networks/opennap/opennapInteractive.ml Mon Jan 16 16:05:14 2006
@@ -162,22 +162,16 @@
let _ =
server_ops.op_server_info <- (fun s ->
- {
- P.server_num = (server_num s);
+ { (impl_server_info s.server_server) with
+
P.server_network = network.network_num;
P.server_addr = Ip.addr_of_ip s.server_ip;
P.server_port = s.server_port;
- P.server_realport = 0;
- P.server_score = 0;
- P.server_tags = [];
P.server_nusers = s.server_nusers;
P.server_nfiles = s.server_nfiles;
- P.server_state = server_state s;
P.server_name = s.server_desc;
P.server_description = s.server_net;
- P.server_users = None;
- P.server_banner = "";
- P.server_preferred = false;
+
}
)
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., (continued)
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/04
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/04
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/06
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/07
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/08
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/08
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/11
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/11
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/18
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/18
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/29
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/29
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/01/29