diff options
author | lioux <lioux@FreeBSD.org> | 2007-02-10 16:59:24 +0800 |
---|---|---|
committer | lioux <lioux@FreeBSD.org> | 2007-02-10 16:59:24 +0800 |
commit | 8be5902b7fe4d355f6ec286bd83a633bda54734c (patch) | |
tree | 0d7aefa84360fe5ec2d77240ce88f8629846ab19 | |
parent | 976d674e59ad3d54724873726d607b17b03e134b (diff) | |
download | freebsd-ports-gnome-8be5902b7fe4d355f6ec286bd83a633bda54734c.tar.gz freebsd-ports-gnome-8be5902b7fe4d355f6ec286bd83a633bda54734c.tar.zst freebsd-ports-gnome-8be5902b7fe4d355f6ec286bd83a633bda54734c.zip |
o Update to 2.8.2 cvs release as of date 2007021000
o Bump PORTREVISION
-rw-r--r-- | net-p2p/mldonkey-devel/Makefile | 1 | ||||
-rw-r--r-- | net-p2p/mldonkey-devel/files/patch-cvs-2007021000 (renamed from net-p2p/mldonkey-devel/files/patch-cvs-2006122500) | 5218 |
2 files changed, 4794 insertions, 425 deletions
diff --git a/net-p2p/mldonkey-devel/Makefile b/net-p2p/mldonkey-devel/Makefile index 3ee991f06a35..28198b9ff535 100644 --- a/net-p2p/mldonkey-devel/Makefile +++ b/net-p2p/mldonkey-devel/Makefile @@ -7,6 +7,7 @@ PORTNAME= mldonkey PORTVERSION= 2.8.2 +PORTREVISION= 1 CATEGORIES+= net-p2p MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED} \ ${MASTER_SITE_SAVANNAH} diff --git a/net-p2p/mldonkey-devel/files/patch-cvs-2006122500 b/net-p2p/mldonkey-devel/files/patch-cvs-2007021000 index 6a80f449e25e..4e406feb06d5 100644 --- a/net-p2p/mldonkey-devel/files/patch-cvs-2006122500 +++ b/net-p2p/mldonkey-devel/files/patch-cvs-2007021000 @@ -2,10 +2,10 @@ Index: config/Makefile.in =================================================================== RCS file: /sources/mldonkey/mldonkey/config/Makefile.in,v retrieving revision 1.173 -retrieving revision 1.174 -diff -u -r1.173 -r1.174 +retrieving revision 1.175 +diff -u -r1.173 -r1.175 --- config/Makefile.in 21 Nov 2006 22:29:58 -0000 1.173 -+++ config/Makefile.in 28 Nov 2006 23:58:01 -0000 1.174 ++++ config/Makefile.in 15 Jan 2007 18:27:21 -0000 1.175 @@ -148,7 +148,7 @@ $(CDK)/filepath.ml $(CDK)/string2.ml \ $(CDK)/filename2.ml $(CDK)/list2.ml $(CDK)/hashtbl2.ml \ @@ -15,18 +15,141 @@ diff -u -r1.173 -r1.174 ifneq ("$(PTHREAD_CFLAGS)" , "") CFLAGS += $(PTHREAD_CFLAGS) +@@ -1245,7 +1245,7 @@ + $(PROGRESS_SRCS) $(MAIN_SRCS) + + TARGETS += mlgui$(EXE) mlguistarter$(EXE) +-ifeq ("$(GUI)", "newgui") ++ifeq ("$(GUI)", "newgui1") + TARGETS += mlprogress$(EXE) + endif + +Index: config/configure.in +=================================================================== +RCS file: /sources/mldonkey/mldonkey/config/configure.in,v +retrieving revision 1.289 +retrieving revision 1.290 +diff -u -r1.289 -r1.290 +--- config/configure.in 28 Nov 2006 23:17:31 -0000 1.289 ++++ config/configure.in 11 Jan 2007 12:15:37 -0000 1.290 +@@ -1257,7 +1257,7 @@ + else + echo "Do you want this script to try to download and install $LABLGTK_NAME" + echo "LOCALLY in mldonkey directory ?" +- if test "$BATCH" = "no"; then read i; else i=yes; fi ++ if test "$BATCH" = "no"; then read i <&1; else i=yes; fi + case "$i" in + y* | Y*) + Index: distrib/ChangeLog =================================================================== RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v retrieving revision 1.1118 -retrieving revision 1.1133 -diff -u -r1.1118 -r1.1133 +retrieving revision 1.1174 +diff -u -r1.1118 -r1.1174 --- distrib/ChangeLog 28 Nov 2006 23:17:31 -0000 1.1118 -+++ distrib/ChangeLog 8 Dec 2006 12:26:24 -0000 1.1133 -@@ -14,6 +14,45 @@ ++++ distrib/ChangeLog 6 Feb 2007 22:26:58 -0000 1.1174 +@@ -14,6 +14,142 @@ ChangeLog ========= ++2007/02/06 ++5719: Unix2: Fix copying files > 1GB (1073741823 bytes), ++ bug was introduced by patch 5589 after release of 2.8.2 ++ ++2007/02/04 ++5724: http_client: Retry GET request if HEAD request returns http error 400 ++5723: HTML: print tracker errors in html table at 'vd <num>' (Schlumpf) ++5722: HTML: use Printf2.html_mods_cntr () for table row classes (Schlumpf) ++5720: Swarmer: block choice algorithm 2 from patch 5141 is new default ++- remove swarming_block_selection_algorithm = 1 ++ because it finishes chunks too slowly ++- remove swarming_block_selection_algorithm = 3 from TripleM ++ because it uses too much CPU power. ++- remove option swarming_block_selection_algorithm, hard-coded default is now 2 ++- remove option block_switching, hard-coded default is now true ++ ++2007/01/30 ++5717: Optimize function print_command_result ++ ++2007/01/28 ++5715: Improve porttest (Schlumpf) ++- use 'porttest' command to start the network porttest the first time, ++ after this to see the results ++- new command 'force_porttest' to force an new porttest ++- improve html porttest output and make it also available in telnet ++5716: EDK: Do not send share list to servers with state Connecting ++5713: HTML: show messages link in vd clickable (Schlumpf) ++ ++2007/01/25 ++5712: Multiuser: New verbosity "com" to log commands by non-admin users ++5711: Multiuser: Block commands preferred, bs, bp, port for non-admin users ++5642: Swarmer: swarming_block_selection_algorithm = 3 (TripleM) ++- this new algorithm select always the rarest choice, if average availability ++ is below 5, or one choice_availability is below average availability ++- added a hashtable to store blockmaps of uploaders for a given swarmer ++- long term memory usage has to be observed ++5710: Swarmer: Fix chunk propagation (pango) ++ ++2007/01/21 ++5693: "voo changed" prints changed options only, useful for support (Schlumpf) ++5698: EDK: fix display of porttest result images (Schlumpf) ++5699: Multiuser: Fix wrong file path (user_commit_dir) in notification mail ++5695: Command "set": better error text if option does not exist ++5694: Fix small typo in buildinfo ++ ++2007/01/17 ++5673: New core start parameter: -useradd "user pass", needed for Debian package ++5678: New options for command force_web_infos: kind/URL (thx to Schlumpf) ++ ++2007/01/15 ++5691: EDK: Recognize compatibleclient 60: IMPmule (imp-project.net) ++5689: EDK: Log downloading file name when client disconnects ++5684: GUI: Fix build of mlprogress (Alt linux) ++5677: Options: New concept of option types, fix non-admin Sancho http preview ++ ++2007/01/11 ++5665: EDK: Support compressed upload, implement file read cache (TripleM) ++new options: ++- ED2K_upload_compression to enable compressed upload, default true ++- ED2K_upload_compression_threshold, default 2000 bytes ++ Size difference in bytes between one zone (180 kBytes) and its compressed ++ counterpart, which has to occure, to send compressed parts instead of plain. ++- ED2K_upload_compression_level, Zlib compression level, default 9 ++- ED2K_upload_compression_table_size, default 20 ++5669: HTML: Add HTML headers to prohibit browser-side caching (Schlumpf) ++5671: Configure: Fix question whether to compile lablgtk, same as patch 5401 ++5675: Updated Mozilla protocol handler to version 1.10 ++ ++2007/01/08 ++5666: New option upload_complete_chunks (TripleM) ++- default false, if true, each client is allowed to complete only one chunk, ++ independent, if it is empty or partial. this setting overrides ++ upload_full_chunks and dynamic_upload_lifetime, but is, as a failsafe, ++ limited by upload_lifetime (should be set reasonable high) ++5664: EDK: Avoid uploading data more than due ++ to eMules rotating block requests (pango) ++5596: EDK: New option upload_full_chunks (thx to TripleM) ++- If the new option upload_full_chunks is set to true, each client is ++ allowed to receive one chunk, this setting overrides upload_lifetime. ++ Well, not exactly one chunk. eMule has this code in opcode.h: ++ #define SESSIONMAXTRANS (PARTSIZE+20*1024) // ++ "Try to send complete chunks" always sends this amount of data ++ MLdonkey now does the same, if upload_full_chunks is true and client A got ++ 9728000+20*1024 bytes during the current session its upload slot will be ++ revoked unless pending slots are empty. ++5619: EDK: Print network specific infos in command "vc <num>", ++ remove unneeded fields from client structures ++5627: commonHasher: fix wrong arg types from several functions (Schlumpf) ++5626: MinGW: fix missing declarations and wrong pointer ++ initialization in stubs_c.c (Schlumpf) ++ ++2007/01/06 ++5599: EDK: Support for files >4GB (TripleM, pango) ++- this patch does not include >4GB support for Kademlia ++5660: Swarming: Enable wrongly disabled select block memoization (pango) ++5659: GD: Fix wrong months display (skeeve) ++ +2006/12/08 +5617: New option share_scan_interval +- how often (in minutes) should MLDonkey scan all shared directories @@ -69,15 +192,108 @@ diff -u -r1.1118 -r1.1133 2006/11/29 version 2.8.2 = tag release-2-8-2 5597: GD: New option html_mods_vd_gfx_h_intervall (compute values for hourly graph every x minutes) (skeeve) +Index: distrib/ed2k_mozilla/README +=================================================================== +RCS file: /sources/mldonkey/mldonkey/distrib/ed2k_mozilla/README,v +retrieving revision 1.8 +retrieving revision 1.9 +diff -u -r1.8 -r1.9 +--- distrib/ed2k_mozilla/README 23 Oct 2006 12:58:35 -0000 1.8 ++++ distrib/ed2k_mozilla/README 11 Jan 2007 12:14:48 -0000 1.9 +@@ -1,4 +1,4 @@ +-Firefox MLdonkey/eMule Protocol Handler 1.8 ++Firefox MLdonkey/eMule Protocol Handler 1.10 + Copyright (C) 2003 - 2006 Simon Peter <dn.tlp@gmx.net> + + Description: +@@ -88,9 +88,16 @@ + + News: + ----- ++Changes for version 1.10: ++- Fixed another problem with the port GUI configuration option (thanks ++ to Toni Cunat). ++ ++Changes for version 1.9: ++- Fixed port GUI configuration option (thanks to Dennis Plöger). ++ + Changes for version 1.8: + - Support for GUI configuration through Firefox' extensions menu +- (thanks to David Ciecierski <dawid.ciecierski@googlemail.com>). ++ (thanks to David Ciecierski). + + ATTENTION upgraders: If you manually set configuration options + through the about:config dialog for a previous version of this +@@ -119,7 +126,7 @@ + + Changes for version 1.4: + - Added compatibility for the new component system of Firefox 0.9 +- (thanks to Len Walter <len@unsw.edu.au>). ++ (thanks to Len Walter). + - Username is now empty by default. + + Changes for version 1.3: +@@ -161,9 +168,10 @@ + + Contributor(s): + Sven Koch +-Len Walter <len@unsw.edu.au> +-Dan Fritz <templar_of_ni@yahoo.se> +-David Ciecierski <dawid.ciecierski@gmail.com> ++Len Walter ++Dan Fritz ++David Ciecierski ++Dennis Plöger + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or Index: src/daemon/common/commonClient.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonClient.ml,v retrieving revision 1.33 -retrieving revision 1.34 -diff -u -r1.33 -r1.34 +retrieving revision 1.35 +diff -u -r1.33 -r1.35 --- src/daemon/common/commonClient.ml 5 Nov 2006 14:09:38 -0000 1.33 -+++ src/daemon/common/commonClient.ml 2 Dec 2006 12:35:45 -0000 1.34 -@@ -467,16 +467,15 @@ ++++ src/daemon/common/commonClient.ml 8 Jan 2007 11:06:42 -0000 1.35 +@@ -76,6 +76,9 @@ + mutable op_client_dprint_html : ('a -> CommonTypes.ui_conn -> + CommonTypes.file -> string -> bool); + ++(* used to print network specific client infos *) ++ mutable op_client_print_info : ('a -> CommonTypes.ui_conn -> unit); ++ + mutable op_client_debug : ('a -> bool -> unit); + + mutable op_client_can_upload : ('a -> int -> unit); +@@ -159,6 +162,10 @@ + let client = as_client_impl client in + client.impl_client_ops.op_client_dprint_html client.impl_client_val o file str + ++let client_print_info (client: client) o = ++ let c = as_client_impl client in ++ c.impl_client_ops.op_client_print_info c.impl_client_val o ++ + let client_connect client= + let client = as_client_impl client in + client.impl_client_ops.op_client_connect client.impl_client_val +@@ -188,7 +195,7 @@ + s + + let fni n m = failwith (ni n m) +- let ni_ok n m = ignore (ni n m) ++let ni_ok n m = ignore (ni n m) + + let clients_ops = ref [] + +@@ -207,6 +214,7 @@ + op_client_bprint = (fun _ _ -> ni_ok network "client_bprint"); + op_client_dprint = (fun _ _ _ -> ni_ok network "client_dprint"); + op_client_dprint_html = (fun _ _ _ _ -> fni network "client_dprint_html"); ++ op_client_print_info = (fun _ _ -> fni network "client_print_info"); + op_client_can_upload = (fun _ _ -> ni_ok network "client_can_upload"); + op_client_enter_upload_queue = (fun _ -> ni_ok network "client_enter_upload_queue"); + } in +@@ -467,16 +475,15 @@ try let i = client_info c in let ctime = ((BasicSocket.last_time ()) - i.GuiTypes.client_connect_time) / 60 in @@ -97,7 +313,15 @@ diff -u -r1.33 -r1.34 end with _ -> () ) !uploaders -@@ -500,8 +499,10 @@ +@@ -491,7 +498,6 @@ + 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 (); +@@ -500,8 +506,11 @@ T.client_os = None; T.client_release = ""; T.client_emulemod = ""; @@ -109,7 +333,75 @@ diff -u -r1.33 -r1.34 + T.client_session_uploaded = 0L; T.client_upload = None; T.client_sui_verified = None; ++ T.client_file_queue = []; } +Index: src/daemon/common/commonClient.mli +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonClient.mli,v +retrieving revision 1.13 +retrieving revision 1.14 +diff -u -r1.13 -r1.14 +--- src/daemon/common/commonClient.mli 25 Oct 2006 11:12:38 -0000 1.13 ++++ src/daemon/common/commonClient.mli 8 Jan 2007 11:06:42 -0000 1.14 +@@ -24,12 +24,14 @@ + 'a -> CommonTypes.ui_conn -> CommonTypes.file -> unit; + mutable op_client_dprint_html : + 'a -> CommonTypes.ui_conn -> CommonTypes.file -> string -> bool; ++ mutable op_client_print_info : 'a -> CommonTypes.ui_conn -> unit; + mutable op_client_debug : 'a -> bool -> unit; + mutable op_client_can_upload : 'a -> int -> unit; + mutable op_client_enter_upload_queue : 'a -> unit; + } + val client_print_html : CommonTypes.client -> CommonTypes.ui_conn -> unit + val client_print : CommonTypes.client -> CommonTypes.ui_conn -> unit ++val client_print_info : CommonTypes.client -> CommonTypes.ui_conn -> unit + val client_must_update : CommonTypes.client -> unit + val client_info : CommonTypes.client -> GuiTypes.client_info + val client_say : CommonTypes.client -> string -> unit +Index: src/daemon/common/commonComplexOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonComplexOptions.ml,v +retrieving revision 1.69 +retrieving revision 1.70 +diff -u -r1.69 -r1.70 +--- src/daemon/common/commonComplexOptions.ml 21 Nov 2006 22:34:33 -0000 1.69 ++++ src/daemon/common/commonComplexOptions.ml 6 Feb 2007 22:26:58 -0000 1.70 +@@ -962,8 +962,6 @@ + [default_incoming_directories] + | l -> l + +-exception Incoming_full +- + let incoming_dir usedir ?user ?needed_space ?network () = + + let directories = +@@ -994,12 +992,13 @@ + in + + let checkdir = ++ let module U = Unix.LargeFile in + try + List.find (fun d -> + let dirname = compute_dir_name d.shdir_dirname in + (* check if temp_directory and incoming are on different partitions *) + try +- if (Unix.stat dirname).Unix.st_dev <> (Unix.stat !!temp_directory).Unix.st_dev then ++ if (U.stat dirname).U.st_dev <> (U.stat !!temp_directory).U.st_dev then + begin + match needed_space with + | None -> true +@@ -1100,8 +1099,9 @@ + Unix2.tryopen_write_zip archive (fun oc -> + List.iter (fun file -> + try +- let s = Unix.stat file in +- Zip.copy_file_to_entry file oc ~level:9 ~mtime:s.Unix.st_mtime file ++ let module U = Unix.LargeFile in ++ let s = U.stat file in ++ Zip.copy_file_to_entry file oc ~level:9 ~mtime:s.U.st_mtime file + with e -> + failwith (Printf.sprintf "Zip: error %s in %s" (Printexc2.to_string e) file) + ) files) Index: src/daemon/common/commonFile.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.ml,v @@ -149,11 +441,27 @@ Index: src/daemon/common/commonGlobals.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v retrieving revision 1.77 -retrieving revision 1.78 -diff -u -r1.77 -r1.78 +retrieving revision 1.81 +diff -u -r1.77 -r1.81 --- src/daemon/common/commonGlobals.ml 28 Nov 2006 23:15:21 -0000 1.77 -+++ src/daemon/common/commonGlobals.ml 3 Dec 2006 20:49:42 -0000 1.78 -@@ -405,6 +405,7 @@ ++++ src/daemon/common/commonGlobals.ml 6 Feb 2007 22:26:58 -0000 1.81 +@@ -263,6 +263,7 @@ + let user_socks = ref ([] : TcpBufferedSocket.t list) + let dialog_history = ref ([] : (int * string * string) list ) + ++exception Incoming_full + + let want_and_not andnot f none value = + (* lprintf "want_and_not [%s]\n" value; *) +@@ -398,6 +399,7 @@ + | Field_Completesources -> "completesources" + | Field_Filename -> "filename" + | Field_Size -> "size" ++ | Field_Size_Hi -> "size_hi" + | Field_Uid -> "uid" + | Field_Bitrate -> "bitrate" + | Field_Codec -> "codec" +@@ -405,6 +407,7 @@ | Field_Lastseencomplete -> "lastcompl" | Field_Medialength -> "mlen" | Field_Mediacodec -> "mediacodec" @@ -161,7 +469,15 @@ diff -u -r1.77 -r1.78 | Field_UNKNOWN s -> s let field_of_string t = -@@ -426,10 +427,11 @@ +@@ -419,6 +422,7 @@ + | "completesources" -> Field_Completesources + | "filename" -> Field_Filename + | "size" -> Field_Size ++ | "size_hi" -> Field_Size_Hi + | "uid" -> Field_Uid + | "bitrate" -> Field_Bitrate + | "codec" -> Field_Codec +@@ -426,10 +430,11 @@ | "lastcompl" -> Field_Lastseencomplete | "mlen" -> Field_Medialength | "mediacodec" -> Field_Mediacodec @@ -174,7 +490,7 @@ diff -u -r1.77 -r1.78 | Field_UNKNOWN s -> String.escaped s | t -> string_of_field t -@@ -438,6 +440,10 @@ +@@ -438,6 +443,10 @@ Printf.sprintf " \"%s\" = %s" (escaped_string_of_field tag) (string_of_tag_value tag.tag_value) @@ -185,15 +501,122 @@ diff -u -r1.77 -r1.78 let rec print_tags tags = match tags with [] -> () +@@ -916,12 +925,12 @@ + let intern_table = StringIntern.create 1000 + let intern s = StringIntern.merge intern_table s + +-let print_command_result o buf result = ++let print_command_result o result = + if use_html_mods o then +- html_mods_table_one_row buf "serversTable" "servers" [ ++ html_mods_table_one_row o.conn_buf "serversTable" "servers" [ + ("", "srh", result); ] + else +- Printf.bprintf buf "%s" result ++ Printf.bprintf o.conn_buf "%s" result + + let _ = + Heap.add_memstat "CommonGlobals" (fun level buf -> +Index: src/daemon/common/commonHasher.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonHasher.ml,v +retrieving revision 1.9 +retrieving revision 1.10 +diff -u -r1.9 -r1.10 +--- src/daemon/common/commonHasher.ml 18 Mar 2006 18:35:54 -0000 1.9 ++++ src/daemon/common/commonHasher.ml 15 Jan 2007 18:28:03 -0000 1.10 +@@ -20,6 +20,14 @@ + open Printf2 + open CommonOptions + ++let log_prefix = "[cHa]" ++ ++let lprintf_nl fmt = ++ lprintf_nl2 log_prefix fmt ++ ++let lprintf_n fmt = ++ lprintf2 log_prefix fmt ++ + type hash_method = MD4 | MD5 | SHA1 | TIGER + + type 'a job = { +@@ -46,14 +54,14 @@ + | None -> raise Not_found + | Some (job, fd) -> + if job_done job then begin +- if !verbose_md4 then lprintf_nl "[cHa] Finished %s job %s %Ld %Ld" ++ if !verbose_md4 then lprintf_nl "Finished %s job %s %Ld %Ld" + (match job.job_method with + MD5 -> "MD5" | TIGER -> "TIGER" | SHA1 -> "SHA1" | MD4 -> "MD4") + job.job_name job.job_begin job.job_len; + current_job := None; + Unix.close fd; + (try job.job_handler job with e -> +- lprintf_nl "[cHa] exception %s in job_handler" ++ lprintf_nl "exception %s in job_handler" + (Printexc2.to_string e); + ); + raise Not_found +@@ -72,7 +80,7 @@ + current_job := Some (job, fd); + job_start job fd; + with e -> +- lprintf_nl "[cHa] Exception %s in starting job" ++ lprintf_nl "Exception %s in starting job" + (Printexc2.to_string e); + ) + +Index: src/daemon/common/commonHasher_c.c +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonHasher_c.c,v +retrieving revision 1.11 +retrieving revision 1.12 +diff -u -r1.11 -r1.12 +--- src/daemon/common/commonHasher_c.c 9 Jan 2006 00:25:58 -0000 1.11 ++++ src/daemon/common/commonHasher_c.c 8 Jan 2007 11:03:09 -0000 1.12 +@@ -335,20 +335,20 @@ + long bsize; + switch(job_method) { + case METHOD_MD4: +- md4_unsafe64_fd_direct(job_fd, job_begin_pos, job_len, job_result); ++ md4_unsafe64_fd_direct(job_fd, job_begin_pos, job_len, p_job_result); + break; + + case METHOD_MD5: +- md5_unsafe64_fd_direct(job_fd, job_begin_pos, job_len, job_result); ++ md5_unsafe64_fd_direct(job_fd, job_begin_pos, job_len, p_job_result); + break; + + case METHOD_SHA1: +- sha1_unsafe64_fd_direct(job_fd, job_begin_pos, job_len, job_result); ++ sha1_unsafe64_fd_direct(job_fd, job_begin_pos, job_len, p_job_result); + break; + + case METHOD_TIGER: + bsize = tiger_block_size(job_len); +- tiger_tree_fd(job_fd, job_len, 0, bsize, job_result); ++ tiger_tree_fd(job_fd, job_len, 0, bsize, p_job_result); + break; + + default: Index: src/daemon/common/commonInteractive.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml,v retrieving revision 1.85 -retrieving revision 1.87 -diff -u -r1.85 -r1.87 +retrieving revision 1.90 +diff -u -r1.85 -r1.90 --- src/daemon/common/commonInteractive.ml 26 Nov 2006 13:54:09 -0000 1.85 -+++ src/daemon/common/commonInteractive.ml 3 Dec 2006 20:49:42 -0000 1.87 -@@ -222,7 +222,7 @@ ++++ src/daemon/common/commonInteractive.ml 6 Feb 2007 22:26:58 -0000 1.90 +@@ -200,8 +200,6 @@ + name. + *) + +-exception Incoming_full +- + let file_commit file = + let impl = as_file_impl file in + if impl.impl_file_state = FileDownloaded then +@@ -222,7 +220,7 @@ let new_name = file_commited_name incoming.shdir_dirname file in if Unix2.is_directory file_name then begin Unix2.safe_mkdir new_name; @@ -202,7 +625,21 @@ diff -u -r1.85 -r1.87 end; (* the next line really moves the file *) -@@ -714,7 +714,7 @@ +@@ -331,7 +329,12 @@ + let incoming = incoming_dir (Unix2.is_directory (file_disk_name file)) () in + + let line4 = if !!url_in_mail = "" then "" else +- Printf.sprintf "\r\n<%s/%s/%s>\r\n" !!url_in_mail incoming.shdir_dirname (Url.encode (file_best_name file)) ++ Printf.sprintf "\r\n<%s/%s%s/%s>\r\n" ++ !!url_in_mail ++ incoming.shdir_dirname ++ (if (file_owner file).user_commit_dir = "" then "" ++ else Printf.sprintf "/%s" (file_owner file).user_commit_dir) ++ (Url.encode (file_best_name file)) + in + + let line5 = if !!auto_commit then "" else +@@ -714,7 +717,7 @@ | Q_MP3_BITRATE _ -> let bitrate = get_arg "bitrate" in if bitrate = "" then raise Not_found; @@ -211,7 +648,31 @@ diff -u -r1.85 -r1.87 in try -@@ -874,14 +874,14 @@ +@@ -752,12 +755,11 @@ + + let opfile_args r opfile = + let prefix = r.network_shortname ^ "-" in +- let args = simple_options prefix opfile in +- args ++ simple_options prefix opfile true + + let all_simple_options () = + let options = ref (sort_options +- (simple_options "" downloads_ini) ++ (simple_options "" downloads_ini true) + ) + in + networks_iter_all (fun r -> +@@ -807,7 +809,7 @@ + let apply_on_fully_qualified_options name f = + if !verbose then lprintf_nl "Change option %s" name; + let rec iter prefix opfile = +- let args = simple_options prefix opfile in ++ let args = simple_options prefix opfile true in + List.iter (fun o -> + (* lprintf "Compare [%s] [%s]\n" o.option_name name; *) + if o.option_name = name then +@@ -874,14 +876,14 @@ | QHasMinVal (field, value) -> begin match field with @@ -228,21 +689,169 @@ diff -u -r1.85 -r1.87 | Field_Size | _ -> () end +Index: src/daemon/common/commonMessages.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonMessages.ml,v +retrieving revision 1.60 +retrieving revision 1.62 +diff -u -r1.60 -r1.62 +--- src/daemon/common/commonMessages.ml 5 Nov 2006 14:11:29 -0000 1.60 ++++ src/daemon/common/commonMessages.ml 28 Jan 2007 20:39:59 -0000 1.62 +@@ -661,6 +661,8 @@ + <title>MLdonkey: Web Interface</title> + <meta name=\"generator\" content=\"MLDonkey\" /> + <meta name=\"robots\" content=\"noindex,nofollow\" /> ++<meta http-equiv=\"Expires\" content=\"-1\" /> ++<meta http-equiv=\"Pragma\" content=\"no-cache\" /> + <link rel=\"shortcut icon\" href=\"favicon.ico\" type=\"image/x-icon\" /> + <link href=\"h.css\" rel=\"stylesheet\" type=\"text/css\" /> + <script type=\"text/javascript\" src=\"i.js\"> +@@ -1117,6 +1119,9 @@ + <TD class=\"bu bbig\" title=\"Sysinfo\" + onMouseOver=\"mOvr(this,'mOvr1');\" onMouseOut=\"mOut(this);\" + onClick=\"mSub('output','sysinfo')\">Sysinfo</TD> ++<TD class=\"bu bbig\" title=\"Porttest\" ++onMouseOver=\"mOvr(this,'mOvr1');\" onMouseOut=\"mOut(this);\" ++onClick=\"mSub('output','porttest')\">Porttest</TD> + <TD class=\"bu bbig\" title=\"View ChangeLog\" + onMouseOver=\"mOvr(this,'mOvr1');\" onMouseOut=\"mOut(this);\" + onClick=\"top.output.location.href='http://savannah.nongnu.org/cgi-bin/viewcvs/mldonkey/mldonkey/distrib/ChangeLog?rev=HEAD&content-type=text/vnd.viewcvs-markup'\">ChangeLog</TD> Index: src/daemon/common/commonOptions.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v retrieving revision 1.190 -retrieving revision 1.193 -diff -u -r1.190 -r1.193 +retrieving revision 1.197 +diff -u -r1.190 -r1.197 --- src/daemon/common/commonOptions.ml 28 Nov 2006 23:15:21 -0000 1.190 -+++ src/daemon/common/commonOptions.ml 8 Dec 2006 12:26:24 -0000 1.193 -@@ -1267,8 +1267,16 @@ ++++ src/daemon/common/commonOptions.ml 4 Feb 2007 17:19:50 -0000 1.197 +@@ -273,14 +273,15 @@ + end + end + +-let define_option a b ?desc c d e = ++let define_option a b ?desc ?restart ?public ?internal c d e = + match desc with +- None -> define_option a b (_s c) d e +- | Some desc -> define_option a b ~desc: (_s desc) (_s c) d e +-let define_expert_option a b ?desc c d e = ++ None -> define_option a b (_s c) d e ?restart ?public ?internal ++ | Some desc -> define_option a b ~desc: (_s desc) (_s c) d e ?restart ?public ?internal ++ ++let define_expert_option a b ?desc ?restart ?public ?internal c d e = + match desc with +- None -> define_expert_option a b (_s c) d e +- | Some desc -> define_expert_option a b ~desc: (_s desc) (_s c) d e ++ None -> define_expert_option a b (_s c) d e ?restart ?public ?internal ++ | Some desc -> define_expert_option a b ~desc: (_s desc) (_s c) d e ?restart ?public ?internal + + let string_list_option = define_option_class "String" + (fun v -> +@@ -478,34 +479,42 @@ + + let gui_port = define_option current_section ["gui_port"] + ~desc: "The port to connect the GUI" ++ ~restart: true + "port for Graphical Interfaces" + int_option 4001 + + let gift_port = define_option current_section ["gift_port"] + ~desc: "The port to connect for GiFT GUIs." ++ ~restart: true + "port for GiFT Graphical Interfaces interaction. It was 1213, but the default is + now 0 for disabled, because it does not check for a password." + int_option 0 + + let http_port = define_option current_section ["http_port"] + ~desc: "The port to connect via HTTP" ++ ~public: true ++ ~restart: true + "The port used to connect to your client with a WEB browser" + int_option 4080 + + let telnet_port = define_option current_section ["telnet_port"] + ~desc: "The port to connect via telnet" ++ ~restart: true + "port for user interaction" + int_option 4000 + + let http_bind_addr = define_expert_option current_section ["http_bind_addr"] ++ ~restart: true + "The IP address used to bind the http server" + Ip.option (Ip.any) + + let gui_bind_addr = define_expert_option current_section ["gui_bind_addr"] ++ ~restart: true + "The IP address used to bind the gui server" + Ip.option (Ip.of_inet_addr Unix.inet_addr_any) + + let telnet_bind_addr = define_expert_option current_section ["telnet_bind_addr"] ++ ~restart: true + "The IP address used to bind the telnet server" + Ip.option (Ip.of_inet_addr Unix.inet_addr_any) + +@@ -552,6 +561,7 @@ + swarming : debug swarming + hc : http_client messages + hs : http_server messages ++ com : commands by non-admin users + act : debug activity + bw : debug bandwidth + unexp : debug unexpected messages" +@@ -807,6 +817,7 @@ + int_option 200 + + let html_mods_vd_gfx_h_intervall = define_expert_option current_section ["html_mods_vd_gfx_h_intervall"] ++ ~restart: true + "compute values for hourly graph every 1,2,3,4,5,10,15,20,30,60 min + Changes to this option require a core restart." + int_option 60 +@@ -1176,15 +1187,6 @@ + "How many sources to use to download each chunk" + int_option 3 + +-let swarming_block_selection_algorithm = define_expert_option current_section ["swarming_block_selection_algorithm"] +- "What algorithm to use to select blocks (currently 1 or 2)" +- int_option 1 +- +-let block_switching = define_expert_option current_section ["block_switching"] +- "Allows swarmer to switch a source to another block if current block is already +- totally selected by other sources" +- bool_option true +- + let max_recover_gap = define_option current_section ["max_recover_zeroes_gap"] + "The maximal length of zero bytes between non-zero bytes in a file that + should be interpreted as downloaded during a recovery" +@@ -1225,12 +1227,14 @@ + let current_section = startup_section + + let run_as_user = define_option current_section ["run_as_user"] ++ ~restart: true + "The login of the user you want mldonkey to run as, after the ports + have been bound (can be use not to run with root priviledges when + a port < 1024 is needed)" + string_option "" + + let run_as_useruid = define_option current_section ["run_as_useruid"] ++ ~restart: true + "The UID of the user (0=disabled) you want mldonkey to run as, after the ports + have been bound (can be use not to run with root priviledges when + a port < 1024 is needed)" +@@ -1249,6 +1253,7 @@ + bool_option true + + let config_files_security_space = define_expert_option current_section ["config_files_security_space"] ++ ~restart: true + "How many megabytes should MLdonkey keep for saving configuration files." + int_option 10 + +@@ -1267,8 +1272,17 @@ "The directory where temporary files should be put" string_option "temp" -let create_dir_mask = define_option current_section ["create_dir_mask"] - "New directories in incoming_directories are created with these rights" +let share_scan_interval = define_option current_section ["share_scan_interval"] ++ ~restart: true + "How often (in minutes) should MLDonkey scan all shared directories for new/removed files" + int_option 1 + @@ -255,7 +864,23 @@ diff -u -r1.190 -r1.193 string_option "755" let create_file_sparse = define_option current_section ["create_file_sparse"] -@@ -1497,9 +1505,12 @@ +@@ -1374,6 +1388,7 @@ + bool_option false + + let buffer_writes_delay = define_expert_option current_section ["buffer_writes_delay"] ++ ~restart: true + "Buffer writes and flush after buffer_writes_delay seconds (experimental)" + float_option 30. + +@@ -1484,6 +1499,7 @@ + int_option 120 + + let client_bind_addr = define_option current_section ["client_bind_addr"] ++ ~restart: true + "The IP address used to bind the p2p clients" + Ip.option (Ip.of_inet_addr Unix.inet_addr_any) + +@@ -1497,9 +1513,12 @@ TcpBufferedSocket.copy_read_buffer := !!copy_read_buffer ) @@ -271,7 +896,23 @@ diff -u -r1.190 -r1.193 ) let create_mlsubmit = define_expert_option current_section ["create_mlsubmit"] -@@ -1558,7 +1569,7 @@ +@@ -1531,6 +1550,7 @@ + int_option 500000 + + let save_options_delay = define_expert_option current_section ["save_options_delay"] ++ ~restart: true + "The delay between two saves of the 'downloads.ini' file (default is 15 minutes). + Changes to this option require a core restart." + float_option 900.0 +@@ -1540,6 +1560,7 @@ + float_option 30. + + let download_sample_rate = define_expert_option current_section ["download_sample_rate"] ++ ~restart: true + "The delay between one glance at a file and another" + float_option 1. + +@@ -1558,7 +1579,7 @@ let compaction_overhead = define_expert_option current_section ["compaction_overhead"] "The percentage of free memory before a compaction is triggered" @@ -280,7 +921,15 @@ diff -u -r1.190 -r1.193 let space_overhead = define_expert_option current_section ["space_overhead"] "The major GC speed is computed from this parameter. This is the memory -@@ -1708,6 +1719,9 @@ +@@ -1573,6 +1594,7 @@ + int_option 1000 + + let options_version = define_expert_option current_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 14 + +@@ -1708,6 +1730,9 @@ option_hook min_reask_delay (fun _ -> if !!min_reask_delay < 600 then min_reask_delay =:= 600 ); @@ -290,6 +939,42 @@ diff -u -r1.190 -r1.193 option_hook global_login (fun _ -> let len = String.length !!global_login in let prefix = "mldonkey_" in +@@ -1742,11 +1767,6 @@ + close_log () + end + ); +- option_hook swarming_block_selection_algorithm (fun _ -> +- match !!swarming_block_selection_algorithm with +- | 1 | 2 -> () +- | _ -> swarming_block_selection_algorithm =:= 1; +- ); + option_hook max_upload_slots (fun _ -> + if !!max_upload_slots < 3 then + max_upload_slots =:= 3); +@@ -1830,6 +1850,7 @@ + let verbose_supernode = ref false + let verbose_swarming = ref false + let verbose_activity = ref false ++let verbose_user_commands = ref false + let verbose_unexpected_messages = ref false + + let set_all v = +@@ -1858,6 +1879,7 @@ + Http_client.verbose := v; + Http_server.verbose := v; + verbose_activity := v; ++ verbose_user_commands := v; + verbose_unexpected_messages := v + + let _ = +@@ -1893,6 +1915,7 @@ + | "act" -> verbose_activity := true + | "bw" -> incr BasicSocket.verbose_bandwidth + | "unexp" -> verbose_unexpected_messages := true ++ | "com" -> verbose_user_commands := true + + | "all" -> + Index: src/daemon/common/commonSearch.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSearch.ml,v @@ -339,10 +1024,10 @@ Index: src/daemon/common/commonShared.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonShared.ml,v retrieving revision 1.37 -retrieving revision 1.38 -diff -u -r1.37 -r1.38 +retrieving revision 1.39 +diff -u -r1.37 -r1.39 --- src/daemon/common/commonShared.ml 29 Oct 2006 18:58:59 -0000 1.37 -+++ src/daemon/common/commonShared.ml 3 Dec 2006 20:57:56 -0000 1.38 ++++ src/daemon/common/commonShared.ml 6 Feb 2007 22:26:58 -0000 1.39 @@ -43,13 +43,14 @@ mutable impl_shared_size : int64; mutable impl_shared_id : Md4.t; @@ -397,7 +1082,26 @@ diff -u -r1.37 -r1.38 impl_shared_servers = [] } -@@ -354,7 +365,10 @@ +@@ -236,14 +247,15 @@ + waiting_directories := (shared_dir, local_dir) :: !waiting_directories + + let shared_scan_directory shared_dir local_dir = ++ let module U = Unix.LargeFile in + let incoming_files_inode = +- ((Unix.stat ((CommonComplexOptions.incoming_dir false ()).shdir_dirname)).Unix.st_ino) ++ ((U.stat ((CommonComplexOptions.incoming_dir false ()).shdir_dirname)).U.st_ino) + in + let incoming_directories_inode = +- ((Unix.stat ((CommonComplexOptions.incoming_dir true ()).shdir_dirname)).Unix.st_ino) ++ ((U.stat ((CommonComplexOptions.incoming_dir true ()).shdir_dirname)).U.st_ino) + in + let temp_directory_inode = +- ((Unix.stat !!temp_directory).Unix.st_ino) ++ ((U.stat !!temp_directory).U.st_ino) + in + let dirname = shared_dir.shdir_dirname in + let strategy = +@@ -354,7 +366,10 @@ T.shared_requests = impl.impl_shared_requests; T.shared_uids = []; T.shared_sub_files = []; @@ -3920,10 +4624,10 @@ Index: src/daemon/common/commonSources.mli =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSources.mli,v retrieving revision 1.10 -retrieving revision 1.11 -diff -u -r1.10 -r1.11 +retrieving revision 1.12 +diff -u -r1.10 -r1.12 --- src/daemon/common/commonSources.mli 8 Apr 2006 02:16:21 -0000 1.10 -+++ src/daemon/common/commonSources.mli 3 Dec 2006 20:47:12 -0000 1.11 ++++ src/daemon/common/commonSources.mli 8 Jan 2007 11:06:42 -0000 1.12 @@ -16,18 +16,7 @@ along with mldonkey; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -4050,7 +4754,7 @@ diff -u -r1.10 -r1.11 + request_file : file_sources_manager; + mutable request_queue : int; + mutable request_time : int; -+ mutable request_score : int; ++ mutable request_score : int; + } + + and file_sources_manager = { @@ -4188,15 +4892,232 @@ diff -u -r1.10 -r1.11 + val set_source_brand : source -> M.source_brand -> unit + end) + +Index: src/daemon/common/commonSwarming.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSwarming.ml,v +retrieving revision 1.54 +retrieving revision 1.58 +diff -u -r1.54 -r1.58 +--- src/daemon/common/commonSwarming.ml 14 Sep 2006 17:34:34 -0000 1.54 ++++ src/daemon/common/commonSwarming.ml 4 Feb 2007 17:19:50 -0000 1.58 +@@ -2080,7 +2080,7 @@ + (* memoize some results *) + let memoization_calls = ref 0 in + let memoization_hits = ref 0 in +- let debug_memoization = true in ++ let debug_memoization = false in + let memoize h f p = + incr memoization_calls; + try +@@ -2126,10 +2126,8 @@ + let data_per_source = 9728000L // (Int64.of_int !!sources_per_chunk) in + + let need_to_complete_some_blocks_quickly = +- match !!swarming_block_selection_algorithm with +- | 1 -> true +- | 2 -> verification_available && t.t_nverified_chunks < 2 +- | _ -> assert false in ++ verification_available && t.t_nverified_chunks < 2 ++ in + + let create_choice n b = + let block_begin = compute_block_begin s b in +@@ -2201,66 +2199,7 @@ + (choice_availability c) + (choice_preallocated c) in + +- (** > 0 == c1 is best, < 0 = c2 is best, 0 == they're equivalent *) +- let compare_choices1 c1 c2 = +- +- (* avoid overly unbalanced situations *) +- let cmp = +- if choice_remaining_per_uploader c1 < data_per_source || +- choice_remaining_per_uploader c2 < data_per_source then +- compare (choice_remaining_per_uploader c1) +- (choice_remaining_per_uploader c2) else 0 in +- if cmp <> 0 then cmp else +- +- (* Do what Master asked for *) +- let cmp = compare (choice_user_priority c1) +- (choice_user_priority c2) in +- if cmp <> 0 then cmp else +- +- (* Pick really rare gems: if average availability of all +- blocks is higher than 5 connected sources, pick in +- priority blocks present in at most 3 connected sources; +- is that too restrictive ? *) +- let cmp = +- if not need_to_complete_some_blocks_quickly && +- mean_availability > 5 && +- (choice_availability c1 <= 3 || choice_availability c2 <= 3) then +- compare (choice_availability c2) (choice_availability c1) +- else 0 in +- if cmp <> 0 then cmp else +- +- (* try to quickly complete (and validate) chunks; +- if there's only one frontend, each chunk has only one +- block, and looking at siblings make no sense *) +- let cmp = +- if verification_available && several_frontends then +- compare (choice_other_remaining c2) +- (choice_other_remaining c1) +- else 0 in +- if cmp <> 0 then cmp else +- +- (* try to quickly complete blocks *) +- let cmp = +- match choice_unselected_remaining c1, +- choice_unselected_remaining c2 with +- | 0L, 0L -> 0 +- | 0L, _ -> -1 +- | _, 0L -> 1 +- | ur1, ur2 -> compare ur2 ur1 in +- if cmp <> 0 then cmp else +- +- (* pick blocks that won't require allocating more disk space *) +- let cmp = +- match choice_preallocated c1, choice_preallocated c2 with +- | true, false -> 1 +- | false, true -> -1 +- | _ -> 0 in +- if cmp <> 0 then cmp else +- +- (* Can't tell *) +- 0 in +- +- let compare_choices2 c1 c2 = ++ let compare_choices c1 c2 = + (* "RULES" *) + (* Avoid stepping on each other's feet *) + let cmp = +@@ -2330,12 +2269,6 @@ + (* Can't tell *) + 0 in + +- let compare_choices = +- match !!swarming_block_selection_algorithm with +- | 1 -> compare_choices1 +- | 2 -> compare_choices2 +- | _ -> assert false in +- + (* compare a new chunk against a list of best choices numbers (and a + specimen of best choice) *) + let keep_best_chunks chunk_blocks_indexes best_choices specimen = +@@ -2382,9 +2315,7 @@ + currently they're taken care of by linear_select_block + fallback below *) + +- if debug_all then begin +- print_choice specimen +- end; ++ if debug_all then print_choice specimen; + + try + let blocks = +@@ -2690,7 +2621,6 @@ + iter dummy_ranges_cluster b.up_block.block_ranges b more_blocks in + if not (is_dummy_cluster best_cluster) && + best_cluster.cluster_nuploading > 0 && +- !!block_switching && + (file_downloaded t.t_file < file_size t.t_file ** 98L // 100L) then begin + (* it seems they're only sucky choices left on that block, is + there really nothing else better elsewhere ? *) +@@ -2935,18 +2865,14 @@ + mutable occurrence_missing : chunk_occurrence list; + } + +-let propagate_chunk t1 pos1 size destinations copy_data = ++let propagate_chunk t1 pos1 size destinations = + List.iter (fun (t2, j2, pos2) -> + if t1.t_num <> t2.t_num || pos1 <> pos2 then begin + if !verbose then lprintf_nl "Should propagate chunk from %s %Ld to %s %Ld [%Ld]" + (file_best_name t1.t_file) pos1 + (file_best_name t2.t_file) pos2 size; +- (* small catch here: if we don't really copy the data *and* +- chunk content is not the expected value, the chunk will be +- verified each time *) +- if copy_data then +- Unix32.copy_chunk (file_fd t1.t_file) (file_fd t2.t_file) +- pos1 pos2 (Int64.to_int size); ++ Unix32.copy_chunk (file_fd t1.t_file) (file_fd t2.t_file) ++ pos1 pos2 (Int64.to_int size); + set_frontend_state_complete t2 j2 + end + ) destinations +@@ -2954,10 +2880,6 @@ + let dummy_chunk_occurrences () = + { occurrence_present = []; occurrence_missing = [] } + +-(* Compute the digest of zeroed chunks to avoid copying them *) +-let known_chunks_sizes : (int64, unit) Hashtbl.t = Hashtbl.create 5 +-let zeroed_chunks_hashes : (uid_type, unit) Hashtbl.t = Hashtbl.create 5 +- + let duplicate_chunks () = + let chunks = Hashtbl.create 100 in + HS.iter (fun s -> +@@ -2971,25 +2893,6 @@ + chunk_uid = uids.(j); + chunk_size = min (s.s_size -- pos) t.t_chunk_size; + } in +- (try +- ignore (Hashtbl.find known_chunks_sizes c.chunk_size) +- with Not_found -> +- (* new chunk size, compute hashes for zeroed chunk of +- that size. +- No chunk size is bigger than 16MB I hope *) +- if c.chunk_size < Int64.of_int (16 * 1024 * 1024) then begin +- let chunk_size = Int64.to_int c.chunk_size in +- let zeroed_buffer = String.make chunk_size '\000' in +- +- Hashtbl.add zeroed_chunks_hashes +- (Ed2k (Md4.Md4.string zeroed_buffer)) (); +- Hashtbl.add zeroed_chunks_hashes +- (Sha1 (Md4.Sha1.string zeroed_buffer)) (); +- Hashtbl.add zeroed_chunks_hashes +- (TigerTree (Md4.TigerTree.string zeroed_buffer)) () +- end; +- Hashtbl.add known_chunks_sizes c.chunk_size (); +- ); + let occurrences = + try + Hashtbl.find chunks c +@@ -3012,19 +2915,14 @@ + ) s.s_networks + ) swarmers_by_name; + Hashtbl.iter (fun c occurrences -> ++ (* we need a verified chunk to copy over the others *) + match occurrences.occurrence_present, occurrences.occurrence_missing with + | _ , [] + | [], _ -> () + | (t, _, pos) :: _, missing -> +- let is_zeroed_chunk = +- try +- ignore(Hashtbl.find zeroed_chunks_hashes c.chunk_uid); +- false +- with Not_found -> true in +- propagate_chunk t pos c.chunk_size missing (not is_zeroed_chunk) ++ propagate_chunk t pos c.chunk_size missing + ) chunks + +- + let set_verifier t f = + t.t_verifier <- f; + (* TODO: check that false as t_primary is a good value to start with *) Index: src/daemon/common/commonTypes.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonTypes.ml,v retrieving revision 1.64 -retrieving revision 1.65 -diff -u -r1.64 -r1.65 +retrieving revision 1.66 +diff -u -r1.64 -r1.66 --- src/daemon/common/commonTypes.ml 26 Nov 2006 16:36:29 -0000 1.64 -+++ src/daemon/common/commonTypes.ml 3 Dec 2006 20:49:42 -0000 1.65 -@@ -265,6 +265,7 @@ ++++ src/daemon/common/commonTypes.ml 6 Jan 2007 18:15:17 -0000 1.66 +@@ -260,11 +260,13 @@ + | Field_Completesources (* "completesources" *) + | Field_Filename (* "filename" *) + | Field_Size ++| Field_Size_Hi + | Field_Uid + | Field_Filerating | Field_Lastseencomplete | Field_Mediacodec | Field_Medialength @@ -4221,15 +5142,38 @@ diff -u -r1.52 -r1.53 impl_shared_servers = []; } and sh = { +Index: src/daemon/common/commonWeb.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonWeb.ml,v +retrieving revision 1.37 +retrieving revision 1.38 +diff -u -r1.37 -r1.38 +--- src/daemon/common/commonWeb.ml 26 Nov 2006 13:54:09 -0000 1.37 ++++ src/daemon/common/commonWeb.ml 17 Jan 2007 18:51:41 -0000 1.38 +@@ -150,7 +150,7 @@ + with e -> failwith (Printf.sprintf "Unknown kind [%s]" kind) + in + try +- lprintf_nl (_b "saving %s (%s)") kind url; ++ lprintf_nl (_b "request %s (%s)") kind url; + mldonkey_wget url f + with e -> + if can_fail then Index: src/daemon/common/guiDecoding.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/guiDecoding.ml,v retrieving revision 1.66 -retrieving revision 1.67 -diff -u -r1.66 -r1.67 +retrieving revision 1.69 +diff -u -r1.66 -r1.69 --- src/daemon/common/guiDecoding.ml 26 Nov 2006 13:54:09 -0000 1.66 -+++ src/daemon/common/guiDecoding.ml 2 Dec 2006 12:35:45 -0000 1.67 -@@ -816,8 +816,10 @@ ++++ src/daemon/common/guiDecoding.ml 15 Jan 2007 18:26:27 -0000 1.69 +@@ -810,17 +810,18 @@ + client_name = name; + client_rating = rating; + client_chat_port = chat_port; +- client_files = None; + client_connect_time = 0; + client_software = ""; client_os = None; client_release = ""; client_emulemod = ""; @@ -4241,8 +5185,18 @@ diff -u -r1.66 -r1.67 + client_session_uploaded = zero; client_upload = None; client_sui_verified = None; - (* client_sock_addr = ""; *) -@@ -875,8 +877,10 @@ +-(* client_sock_addr = ""; *) ++ client_file_queue = []; + }, pos+8 + else + let num = get_int s pos in +@@ -869,17 +870,18 @@ + client_name = name; + client_rating = rating; + client_chat_port = 0; +- client_files = None; + client_connect_time = connect_time; + client_software = software; client_os = None; client_release = release; client_emulemod = emulemod; @@ -4254,7 +5208,41 @@ diff -u -r1.66 -r1.67 + client_session_uploaded = 0L; client_upload = upload; client_sui_verified = verified; - (* client_sock_addr = sock_addr; *) +-(* client_sock_addr = sock_addr; *) ++ client_file_queue = []; + }, pos + + let default_flags = [ +@@ -1349,6 +1351,9 @@ + M.option_help = ""; + M.option_type = ""; + M.option_advanced = false; ++ M.option_restart = false; ++ M.option_public = false; ++ M.option_internal = false; + } + + let to_gui (proto : int array) opcode s = +@@ -1567,6 +1572,9 @@ + M.option_value = value; + M.option_default = default; + M.option_advanced = advanced; ++ M.option_restart = false; ++ M.option_public = false; ++ M.option_internal = false; + } + else + let optype = +@@ -1628,6 +1636,9 @@ + M.option_value = value; + M.option_default = default; + M.option_advanced = advanced; ++ M.option_restart = false; ++ M.option_public = false; ++ M.option_internal = false; + } + else + let optype = Index: src/daemon/common/guiEncoding.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/guiEncoding.ml,v @@ -4278,11 +5266,19 @@ Index: src/daemon/common/guiTypes.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/common/guiTypes.ml,v retrieving revision 1.34 -retrieving revision 1.35 -diff -u -r1.34 -r1.35 +retrieving revision 1.36 +diff -u -r1.34 -r1.36 --- src/daemon/common/guiTypes.ml 14 Nov 2006 18:42:59 -0000 1.34 -+++ src/daemon/common/guiTypes.ml 2 Dec 2006 12:35:45 -0000 1.35 -@@ -219,8 +219,10 @@ ++++ src/daemon/common/guiTypes.ml 8 Jan 2007 11:06:42 -0000 1.36 +@@ -211,7 +211,6 @@ + mutable client_type : client_type; + mutable client_tags: CommonTypes.tag list; + mutable client_name : string; +- mutable client_files: file_tree option; + mutable client_rating : int; + mutable client_chat_port : int; + mutable client_connect_time : int; +@@ -219,11 +218,13 @@ mutable client_os : string option; mutable client_release : string; mutable client_emulemod : string; @@ -4294,16 +5290,146 @@ diff -u -r1.34 -r1.35 + mutable client_session_uploaded : int64; mutable client_upload : string option; mutable client_sui_verified : bool option; - (* mutable client_sock_addr : string; *) +-(* mutable client_sock_addr : string; *) ++ mutable client_file_queue : CommonTypes.file list; + } + + type client_stats = { Index: src/daemon/driver/driverCommands.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v retrieving revision 1.202 -retrieving revision 1.209 -diff -u -r1.202 -r1.209 +retrieving revision 1.220 +diff -u -r1.202 -r1.220 --- src/daemon/driver/driverCommands.ml 28 Nov 2006 23:15:21 -0000 1.202 -+++ src/daemon/driver/driverCommands.ml 8 Dec 2006 12:26:24 -0000 1.209 -@@ -343,7 +343,7 @@ ++++ src/daemon/driver/driverCommands.ml 6 Feb 2007 22:26:58 -0000 1.220 +@@ -78,7 +78,12 @@ + [] -> + Gettext.buftext buf no_such_command cmd + | (command, _, arg_kind, help) :: tail -> +- if command = cmd then ++ if command = cmd then begin ++ if !verbose_user_commands && not (user2_is_admin output.conn_user.ui_user) then ++ lprintf_nl "user %s issued command %s%s" ++ output.conn_user.ui_user.user_name ++ cmd ++ (if args = [] then "" else ", args " ^ String.concat " " args); + Buffer.add_string buf ( + match arg_kind, args with + Arg_none f, [] -> f output +@@ -88,6 +93,7 @@ + | Arg_three f, [a1;a2;a3] -> f a1 a2 a3 output + | _ -> bad_number_of_args command help + ) ++ end + else + iter tail + in +@@ -100,20 +106,21 @@ + html_mods_table_header buf "upstatsTable" "upstats" [ + ( "0", "srh", "Option name", "Name (Help=mouseOver)" ) ; + ( "0", "srh", "Option value", "Value (press ENTER to save)" ) ; +- ( "0", "srh", "Option default", "Default" ) ] ++ ( "0", "srh", "Option default", "Default" ); ++ ( "0", "srh", "Option type", "Type" ); ++ ] + else + html_mods_table_header buf "voTable" "vo" [ + ( "0", "srh", "Option name", "Name" ) ; + ( "0", "srh", "Option value", "Value (press ENTER to save)" ) ; + ( "0", "srh", "Option default", "Default" ) ; ++ ( "0", "srh", "Option type", "Type" ); + ( "0", "srh", "Option description", "Help" ) ]; + +- let counter = ref 0 in ++ html_mods_cntr_init (); + + List.iter (fun o -> +- incr counter; +- if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr class=\\\"dl-1\\\"" +- else Printf.bprintf buf "\\<tr class=\\\"dl-2\\\""; ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"" (html_mods_cntr ()); + + if !!html_mods_use_js_helptext then + Printf.bprintf buf " onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\" onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>" +@@ -121,27 +128,20 @@ + else + Printf.bprintf buf "\\>"; + +- if String.contains o.option_value '\n' then begin ++ if String.contains o.option_value '\n' then + Printf.bprintf buf "\\<td class=\\\"sr\\\"\\> +- \\<a href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\> +- \\<form action=\\\"submit\\\" target=\\\"$S\\\" onsubmit=\\\"javascript: {setTimeout('window.location.replace(window.location.href)',500);}\\\"\\> +- \\<input type=hidden name=setoption value=q\\>\\<input type=hidden name=option value=%s\\>\\</td\\> +- \\<td\\>\\<textarea name=value rows=5 cols=20 wrap=virtual\\>%s\\</textarea\\> +- \\<input type=submit value=Modify\\>\\</td\\>\\</form\\> +- \\<td class=\\\"sr\\\"\\>%s\\</td\\>" +- (String2.upp_initial o.option_name) o.option_name o.option_name o.option_value o.option_default; +- +- if not !!html_mods_use_js_helptext then +- Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" (Str.global_replace (Str.regexp "\n") "\\<br\\>" o.option_help); +- +- Printf.bprintf buf "\\</tr\\>" +- end +- +- else begin ++\\<a href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\> ++\\<form action=\\\"submit\\\" target=\\\"$S\\\" onsubmit=\\\"javascript: {setTimeout('window.location.replace(window.location.href)',500);}\\\"\\> ++\\<input type=hidden name=setoption value=q\\>\\<input type=hidden name=option value=%s\\>\\</td\\> ++\\<td\\>\\<textarea name=value rows=5 cols=20 wrap=virtual\\>%s\\</textarea\\> ++\\<input type=submit value=Modify\\>" ++ (String2.upp_initial o.option_name) o.option_name o.option_name o.option_value ++ else ++ begin + Printf.bprintf buf "\\<td class=\\\"sr\\\"\\> +- \\<a href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\>\\</td\\> +- \\<td class=\\\"sr\\\"\\>\\<form action=\\\"submit\\\" target=\\\"$S\\\" onsubmit=\\\"javascript: {setTimeout('window.location.replace(window.location.href)',500);}\\\"\\> +- \\<input type=hidden name=setoption value=q\\>\\<input type=hidden name=option value=%s\\>" ++\\<a href=\\\"http://mldonkey.sourceforge.net/%s\\\"\\>%s\\</a\\>\\</td\\> ++\\<td class=\\\"sr\\\"\\>\\<form action=\\\"submit\\\" target=\\\"$S\\\" onsubmit=\\\"javascript: {setTimeout('window.location.replace(window.location.href)',500);}\\\"\\> ++\\<input type=hidden name=setoption value=q\\>\\<input type=hidden name=option value=%s\\>" + (String2.upp_initial o.option_name) o.option_name o.option_name; + + if o.option_value = "true" || o.option_value = "false" then +@@ -153,14 +153,15 @@ + Printf.bprintf buf "\\<input style=\\\"font-family: verdana; font-size: 10px;\\\" + type=text name=value size=20 value=\\\"%s\\\"\\>" + o.option_value; +- +- Printf.bprintf buf "\\</td\\>\\</form\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>" (shorten o.option_default 40); +- +- if not !!html_mods_use_js_helptext then +- Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" (Str.global_replace (Str.regexp "\n") "\\<br\\>" o.option_help); +- +- Printf.bprintf buf "\\</tr\\>" + end; ++ Printf.bprintf buf "\\</td\\>\\</form\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>" (shorten o.option_default 40); ++ Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" ++ ((if o.option_restart then Printf.sprintf "restart " else "") ^ ++ (if o.option_internal then Printf.sprintf "internal " else "") ^ ++ (if o.option_public then Printf.sprintf "public " else "")); ++ if not !!html_mods_use_js_helptext then ++ Printf.bprintf buf "\\<td class=\\\"sr\\\"\\>%s\\</td\\>" (Str.global_replace (Str.regexp "\n") "\\<br\\>" o.option_help); ++ Printf.bprintf buf "\\</tr\\>" + + )list; + Printf.bprintf buf "\\</table\\>\\</div\\>" +@@ -208,11 +209,9 @@ + ( "0", "srh", "Weekdays", "Weekdays" ) ; + ( "0", "srh", "Hours", "Hours" ) ; + ( "0", "srh", "Command", "Command" ) ] ; +- let counter = ref 0 in ++ html_mods_cntr_init (); + List.iter (fun (wdays, hours, command) -> +- incr counter; +- if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr class=\\\"dl-1\\\"\\>" +- else Printf.bprintf buf "\\<tr class=\\\"dl-2\\\"\\>"; ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); + let wdays_string = ref "" in + let hours_string = ref "" in + List.iter (fun day -> +@@ -343,7 +342,7 @@ web_infos_add kind period url; CommonWeb.load_url true kind url; "url added to web_infos. downloading now" @@ -4312,44 +5438,162 @@ diff -u -r1.202 -r1.209 ^"\t\t\t\t\tkind is either server.met (if the downloaded file is a server.met)\n" ^"\t\t\t\t\tperiod is the period between updates (in hours, default 0 = only loaded at startup)"; -@@ -390,7 +390,12 @@ +@@ -357,10 +356,23 @@ + "URL does not exists in web_infos" + ), "<url> :\t\t\tremove URL from web_infos"; + +- "force_web_infos", Arg_none (fun o -> +- CommonWeb.load_web_infos false true; +- "downloading all web_infos URLs" +- ), ":\t\t\tforce downloading all web_infos URLs"; ++ "force_web_infos", Arg_multiple (fun args o -> ++ (match args with ++ | [] -> CommonWeb.load_web_infos false true; ++ "requesting all web_infos files" ++ | args -> let list = ref [] in ++ List.iter (fun arg -> ++ List.iter (fun (kind, _, url) -> ++ if kind = arg || url = arg then begin ++ CommonWeb.load_url false kind url; ++ list := arg :: !list ++ end ++ ) !!web_infos) args; ++ if !list = [] then ++ Printf.sprintf "found no web_infos entries for %s" (String.concat " " args) ++ else ++ Printf.sprintf "requesting web_infos %s" (String.concat " " !list)) ++ ), "[<list of kind|URL>] :\tre-download web_infos, leave empty to re-download all"; + + "recover_temp", Arg_none (fun o -> + networks_iter (fun r -> +@@ -378,9 +390,8 @@ + ), ":\t\t\t\trecover lost files from temp directory"; + + "vc", Arg_multiple (fun args o -> ++ let buf = o.conn_buf in + if args = ["all"] then begin +- let buf = o.conn_buf in +- + if use_html_mods o then html_mods_table_header buf "vcTable" "vc" ([ + ( "1", "srh ac", "Client number", "Num" ) ; + ( "0", "srh", "Network", "Network" ) ; +@@ -390,29 +401,40 @@ ( "0", "srh", "Client brand", "CB" ) ; ( "0", "srh", "Client release", "CR" ) ; ] @ - (if !!emule_mods_count then [( "0", "srh", "eMule MOD", "EM" )] else [])); + (if !!emule_mods_count then [( "0", "srh", "eMule MOD", "EM" )] else []) + @ [ ++ ( "0", "srh", "Client file queue", "Q" ) ; + ( "1", "srh ar", "Total UL bytes to this client for all files", "tUL" ) ; + ( "1", "srh ar br", "Total DL bytes from this client for all files", "tDL" ) ; + ( "1", "srh ar", "Session UL bytes to this client for all files", "sUL" ) ; + ( "1", "srh ar", "Session DL bytes from this client for all files", "sDL" )]); - let counter = ref 0 in +- let counter = ref 0 in ++ html_mods_cntr_init (); let all_clients_list = clients_get_all () in -@@ -409,7 +414,12 @@ + List.iter (fun num -> + let c = client_find num in + let i = client_info c in +- if use_html_mods o then Printf.bprintf buf "\\<tr class=\\\"%s\\\" ++ if use_html_mods o then Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\" + title=\\\"Add as friend\\\" + onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\" + onMouseOver=\\\"mOvr(this);\\\" + onMouseOut=\\\"mOut(this);\\\"\\>" +- (if (!counter mod 2 == 0) then "dl-1" else "dl-2") num; ++ (html_mods_cntr ()) num; + client_print c o; + if use_html_mods o then + html_mods_td buf ([ (client_software i.client_software i.client_os, "sr", client_software_short i.client_software i.client_os); ("", "sr", i.client_release); ] @ - (if !!emule_mods_count then [("", "sr", i.client_emulemod)] else [])); + (if !!emule_mods_count then [("", "sr", i.client_emulemod)] else []) + @ [ ++ ("", "sr", Printf.sprintf "%d" (List.length i.client_file_queue)); + ("", "sr ar", (size_of_int64 i.client_total_uploaded)); + ("", "sr ar br", (size_of_int64 i.client_total_downloaded)); + ("", "sr ar", (size_of_int64 i.client_session_uploaded)); + ("", "sr ar", (size_of_int64 i.client_session_downloaded))]); if use_html_mods o then Printf.bprintf buf "\\</tr\\>" else Printf.bprintf buf "\n"; - incr counter; -@@ -423,7 +433,7 @@ - client_print c o; +- incr counter; + ) all_clients_list; + if use_html_mods o then Printf.bprintf buf "\\</table\\>\\</div\\>"; + end +@@ -420,18 +442,18 @@ + List.iter (fun num -> + let num = int_of_string num in + let c = client_find num in +- client_print c o; ++ try client_print_info c o with e -> print_command_result o (Printexc2.to_string e); ) args; "" - ), "<num> :\t\t\t\tview client (use arg 'all' for all clients)"; + ), "<num|all> :\t\t\t\tview client (use arg 'all' for all clients)"; "version", Arg_none (fun o -> - print_command_result o o.conn_buf (CommonGlobals.version ()); -@@ -848,7 +858,7 @@ +- print_command_result o o.conn_buf (CommonGlobals.version ()); ++ print_command_result o (CommonGlobals.version ()); + "" + ), ":\t\t\t\tprint mldonkey version"; + + "uptime", Arg_none (fun o -> +- print_command_result o o.conn_buf (log_time () ^ "- up " ^ ++ print_command_result o (log_time () ^ "- up " ^ + Date.time_to_string (last_time () - start_time) "verbose"); + "" + ), ":\t\t\t\tcore uptime"; +@@ -497,7 +519,7 @@ + + "message_log", Arg_multiple (fun args o -> + let buf = o.conn_buf in +- let counter = ref 0 in ++ html_mods_cntr_init (); + + (match args with + [arg] -> +@@ -531,8 +553,8 @@ + + Fifo.iter (fun (t,i,num,n,s) -> + if use_html_mods o then begin +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>" +- (if (!counter mod 2 == 0) then "dl-1" else "dl-2"); ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" ++ (html_mods_cntr ()); + html_mods_td buf [ + ("", "sr", Date.simple (BasicSocket.date_of_int t)); + ("", "sr", i); +@@ -544,7 +566,6 @@ + else + Printf.bprintf buf "\n%s [client #%d] %s(%s): %s\n" + (Date.simple (BasicSocket.date_of_int t)) num n i s; +- incr counter; + ) chat_message_fifo; + if use_html_mods o then Printf.bprintf buf + "\\</table\\>\\</div\\>\\</div\\>"; +@@ -783,7 +804,7 @@ + print_upstats o !list (Some s) + | _ -> () + ) +- else print_command_result o o.conn_buf "You are not allowed to use this command"; ++ else print_command_result o "You are not allowed to use this command"; + _s "" + ), "<num> :\t\t\tshow list of files published on server <num>"; + +@@ -824,7 +845,7 @@ + | _ -> false + in + let print_result v = +- print_command_result o o.conn_buf ++ print_command_result o + (Printf.sprintf (_b "Disconnected %d server%s") !counter (Printf2.print_plural_s !counter)) + in + match args with +@@ -848,7 +869,7 @@ ) args; print_result !counter; "" @@ -4358,7 +5602,7 @@ diff -u -r1.202 -r1.209 ] -@@ -896,7 +906,7 @@ +@@ -896,7 +917,7 @@ ) args; Printf.sprintf (_b "%d friends removed") (List.length args) end @@ -4367,7 +5611,155 @@ diff -u -r1.202 -r1.209 "friends", Arg_none (fun o -> let buf = o.conn_buf in -@@ -1362,7 +1372,7 @@ +@@ -930,19 +951,18 @@ + ( "0", "srh", "Name", "Name" ) ; + ( "0", "srh", "State", "State" ) ] ; + end; +- let counter = ref 0 in ++ html_mods_cntr_init (); + List.iter (fun c -> + let i = client_info c in + let n = network_find_by_num i.client_network in + if use_html_mods o then + begin + +- Printf.bprintf buf "\\<tr class=\\\"%s\\\" ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\" + onMouseOver=\\\"mOvr(this);\\\" + onMouseOut=\\\"mOut(this);\\\"\\>" +- (if (!counter mod 2 == 0) then "dl-1" else "dl-2"); ++ (html_mods_cntr ()); + +- incr counter; + Printf.bprintf buf " + \\<td title=\\\"Client number\\\" + onClick=\\\"location.href='submit?q=files+%d'\\\" +@@ -1082,7 +1102,6 @@ + ), ":\t\t\t\tprint current bandwidth stats"; + + "bw_toggle", Arg_none (fun o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then begin + let ul_bkp = !!max_hard_upload_rate_2 in + let dl_bkp = !!max_hard_download_rate_2 in +@@ -1090,12 +1109,12 @@ + max_hard_download_rate_2 =:= !!max_hard_download_rate; + max_hard_upload_rate =:= ul_bkp; + max_hard_download_rate =:= dl_bkp; +- print_command_result o buf (Printf.sprintf ++ print_command_result o (Printf.sprintf + "new upload rate: %d | new download rate: %d" + !!max_hard_upload_rate !!max_hard_download_rate) + end + else +- print_command_result o buf "You are not allowed to toggle bandwidth"; ++ print_command_result o "You are not allowed to toggle bandwidth"; + "" + ), ":\t\t\t\ttoggle between the two rate sets"; + +@@ -1205,43 +1224,87 @@ + ) , ":\t\t\t\tprint all networks"; + + "enable", Arg_one (fun num o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then + begin + let n = network_find_by_num (int_of_string num) in + network_enable n; +- print_command_result o buf "network enabled" ++ print_command_result o "network enabled" + end + else +- print_command_result o buf "You are not allowed to enable networks"; ++ print_command_result o "You are not allowed to enable networks"; + _s "" + ) , "<num> :\t\t\t\tenable a particular network"; + + "disable", Arg_one (fun num o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then + begin + let n = network_find_by_num (int_of_string num) in + network_disable n; +- print_command_result o buf "network disabled" ++ print_command_result o "network disabled" + end + else +- print_command_result o buf "You are not allowed to disable networks"; ++ print_command_result o "You are not allowed to disable networks"; + _s "" + ) , "<num> :\t\t\t\tdisable a particular network"; ++ ++ "force_porttest", Arg_none (fun o -> ++ networks_iter (fun n -> ++ match network_porttest_result n with ++ | PorttestNotAvailable -> () ++ | _ -> network_porttest_start n; ++ ); ++ if use_html_mods o then ++ print_command_result o "porttest started, use command ++ \\<u\\>\\<a onclick=\\\"javascript:window.location.href='submit?q=porttest'\\\"\\>porttest\\</a\\>\\</u\\> to see results" ++ else ++ print_command_result o "porttest started, use command 'porttest' to see results"; ++ "" ++ ) , ":\t\t\tforce start network porttest"; + + "porttest", Arg_none (fun o -> + let buf = o.conn_buf in ++ let age time = Date.time_to_string (BasicSocket.last_time () - time) "verbose" in ++ let list = ref [] in ++ let put_list e = list := e :: !list in + networks_iter (fun n -> +- match network_porttest_result n with +- PorttestNotAvailable -> () +- | _ -> network_porttest_start n); +- if o.conn_output = HTML then +- Printf.bprintf buf "Click this \\<a href=\\\"porttest\\\"\\>link\\</a\\> to see results" +- else +- Printf.bprintf buf "Test started, you need a HTML browser to display results"; ++ match network_porttest_result n with ++ | PorttestNotAvailable -> ++ put_list (n.network_name , "Porttest not available") ++ | PorttestNotStarted -> ++ put_list (n.network_name , "Porttest started"); ++ network_porttest_start n ++ | PorttestInProgress time -> ++ put_list (n.network_name , Printf.sprintf "Porttest in progress, started %s ago" (age time)) ++ | PorttestResult (time, s) -> ++ put_list (n.network_name , Printf.sprintf "Porttest finished %s ago \n%s" (age time) s) ++ ); ++ if use_html_mods o then begin ++ Printf.bprintf buf "\\<div class=\\\"shares\\\"\\>\\<table class=main cellspacing=0 cellpadding=0\\> ++ \\<tr\\>\\<td\\>\\<table cellspacing=0 cellpadding=0 width=100%%\\> ++ \\<tr\\>\\<td class=downloaded width=100%%\\>\\</td\\> ++ \\<td nowrap class=\\\"fbig\\\"\\> ++ \\<a onclick=\\\"javascript:window.location.href='submit?q=force_porttest'\\\"\\>Restart porttest\\</a\\>\\</td\\> ++ \\<td nowrap class=\\\"fbig pr\\\"\\> ++ \\<a onclick=\\\"javascript:window.location.reload()\\\"\\>Refresh results\\</a\\>\\</td\\> ++ \\</tr\\>\\</table\\>\\</td\\>\\</tr\\>\\<tr\\>\\<td\\>"; ++ html_mods_table_header buf "sharesTable" "shares" [ ++ ( "0", "srh", "Network", "Network" ) ; ++ ( "0", "srh", "Result", "Result" ) ] ++ end; ++ html_mods_cntr_init (); ++ List.iter (fun (net, result) -> ++ if use_html_mods o then ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" ++ (html_mods_cntr ()) net (Str.global_replace (Str.regexp "\n") "\\<br\\>" result) ++ else ++ Printf.bprintf buf "----- %s: -----\n%s\n\n" net result; ++ ) !list; ++ if use_html_mods o then ++ Printf.bprintf buf "\\</table\\>\\</div\\>\\</td\\>\\</tr\\>\\</table\\>" ++ else ++ Printf.bprintf buf "\n\nuse command 'porttest' again to refresh the results \nuse command 'force_porttest' to force a new porttest"; + "" +- ) , ":\t\t\t\tstart network porttest"; ++ ) , ":\t\t\t\tprint network porttest results"; + + ] + +@@ -1362,7 +1425,7 @@ (if s.search_waiting = 0 then _s "done" else string_of_int s.search_waiting) s.search_nresults @@ -4376,7 +5768,54 @@ diff -u -r1.202 -r1.209 user.ui_user_searches) end; "" -@@ -1767,6 +1777,7 @@ +@@ -1475,8 +1538,9 @@ + with _ -> + Options.set_simple_option downloads_ini name value; + Printf.sprintf "option %s value changed" name +- with e -> +- Printf.sprintf "Error %s" (Printexc2.to_string e) ++ with ++ | Not_found -> Printf.sprintf "Option %s does not exist" name ++ | e -> Printf.sprintf "Error %s" (Printexc2.to_string e) + end + else + _s "You are not allowed to change options" +@@ -1569,6 +1633,9 @@ + + "voo", Arg_multiple (fun args o -> + let buf = o.conn_buf in ++ let changed_list = List.sort (fun d1 d2 -> compare d1 d2) (List.filter (fun o -> ++ o.option_value <> o.option_default && not (String2.starts_with o.option_name "enable_") ++ ) (CommonInteractive.all_simple_options ())) in + if use_html_mods o then begin + + Printf.bprintf buf "\\<script type=\\\"text/javascript\\\"\\> +@@ -1612,7 +1679,8 @@ + ("Files", "File related options") ; + ("Mail", "eMail information options") ; + ("Net", "activate/deaktivate Networks, some TCP/IP & IP blocking options") ; +- ("Misc", "miscellaneous") ]; ++ ("Misc", "miscellaneous") ; ++ ("changed", "Show changed options") ]; + + Printf.bprintf buf " + \\<td nowrap title=\\\"Show all options\\\" class=\\\"fbig\\\"\\>\\<a onclick=\\\"javascript:window.location.href='submit?q=voo'\\\"\\>All\\</a\\>\\</td\\> +@@ -1650,9 +1718,11 @@ + + list_options_html o ( + match args with +- [] | _ :: _ :: _ -> +- let v= CommonInteractive.all_simple_options () in +- v ++ | [] | _ :: _ :: _ -> ++ CommonInteractive.all_simple_options () ++ ++ | ["changed"] -> ++ changed_list + + | [arg] -> + try +@@ -1767,6 +1837,7 @@ [ strings_of_option previewer; strings_of_option temp_directory; @@ -4384,7 +5823,7 @@ diff -u -r1.202 -r1.209 strings_of_option hdd_temp_minfree; strings_of_option hdd_temp_stop_core; strings_of_option hdd_coredir_minfree; -@@ -1777,7 +1788,8 @@ +@@ -1777,7 +1848,8 @@ strings_of_option allow_browse_share; strings_of_option auto_commit; strings_of_option pause_new_downloads; @@ -4394,7 +5833,164 @@ diff -u -r1.202 -r1.209 strings_of_option create_file_sparse; strings_of_option log_file; strings_of_option log_file_size; -@@ -2415,8 +2427,10 @@ +@@ -1854,6 +1926,8 @@ + strings_of_option backup_options_generations; + strings_of_option small_files_slot_limit; + ] ++ | 9 -> ++ changed_list + + | _ -> + let v = CommonInteractive.some_simple_options (tab - !mtabs) in +@@ -1908,10 +1982,13 @@ + end + + else begin +- list_options o (CommonInteractive.parse_simple_options args) ++ match args with ++ | [] | _ :: _ :: _ -> list_options o (CommonInteractive.all_simple_options ()) ++ | ["9"] | ["changed"] -> list_options o changed_list ++ | [_] -> list_options o (CommonInteractive.parse_simple_options args); + end; + "" +- ), ":\t\t\t\t\tprint all options"; ++ ), "[<option>|changed]:\t\t\tprint options (use * as wildcard), 'changed' prints all changed options, leave empty to print all options"; + + "vwi", Arg_none (fun o -> + let buf = o.conn_buf in +@@ -1920,6 +1997,8 @@ + \\<tr\\>\\<td\\> + \\<table cellspacing=0 cellpadding=0 width=100%%\\>\\<tr\\> + \\<td class=downloaded width=100%%\\>\\</td\\> ++\\<td nowrap title=\\\"force downloading all web_infos files\\\" class=\\\"fbig\\\"\\> ++\\<a onclick=\\\"javascript: {parent.fstatus.location.href='submit?q=force_web_infos';}\\\"\\>Re-download all\\</a\\> + \\<td nowrap class=\\\"fbig pr\\\"\\>\\<a onclick=\\\"javascript: { + var getdir = prompt('Input: <kind> <URL> [<period>]','server.met URL') + parent.fstatus.location.href='submit?q=urladd+' + encodeURIComponent(getdir); +@@ -1937,16 +2016,14 @@ + + html_mods_table_header buf "web_infoTable" "vo" [ + ( "0", "srh ac", "Click to remove URL", "Remove" ) ; ++ ( "0", "srh", "Download now", "DL" ) ; + ( "0", "srh", "Option type", "Type" ) ; + ( "0", "srh", "Option delay", "Delay" ) ; + ( "0", "srh", "Option value", "Value" ) ] ; + +- let counter = ref 0 in +- ++ html_mods_cntr_init (); + List.iter (fun (kind, period, url) -> +- incr counter; +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>" +- (if !counter mod 2 == 0 then "dl-1" else "dl-2"); ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); + Printf.bprintf buf " + \\<td title=\\\"Click to remove URL\\\" + onMouseOver=\\\"mOvr(this);\\\" +@@ -1955,6 +2032,13 @@ + parent.fstatus.location.href=\\\"submit?q=urlremove+\\\\\\\"%s\\\\\\\"\\\" + setTimeout(\\\"window.location.reload()\\\",1000);}' + class=\\\"srb\\\"\\>Remove\\</td\\>" (Url.encode url); ++ Printf.bprintf buf " ++ \\<td title=\\\"Download now\\\" ++ onMouseOver=\\\"mOvr(this);\\\" ++ onMouseOut=\\\"mOut(this);\\\" ++ onClick=\\\'javascript:{ ++ parent.fstatus.location.href=\\\"submit?q=force_web_infos+\\\\\\\"%s\\\\\\\"\\\";}' ++ class=\\\"srb\\\"\\>DL\\</td\\>" (Url.encode url); + Printf.bprintf buf " + \\<td title=\\\"%s\\\" class=\\\"sr\\\"\\>%s\\</td\\> + \\<td class=\\\"sr\\\"\\>%d\\</td\\>" url kind period; +@@ -1969,11 +2053,9 @@ + ( "0", "srh", "Web kind", "Kind" ); + ( "0", "srh", "Description", "Type" ) ]; + +- let counter = ref 0 in ++ html_mods_cntr_init (); + List.iter (fun (kind, data) -> +- incr counter; +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>" +- (if !counter mod 2 == 0 then "dl-1" else "dl-2"); ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); + Printf.bprintf buf " + \\<td class=\\\"sr\\\"\\>%s\\</td\\> + \\<td class=\\\"sr\\\"\\>%s\\</td\\>" kind data.description +@@ -2094,9 +2176,9 @@ + | Some p -> Printf.sprintf "%d%%" p in + Printf.bprintf buf "percentused %s\n" (print_percento (Unix32.percentused arg)); + Printf.bprintf buf "percentfree %s\n" (print_percento (Unix32.percentfree arg)); +- let stat = Unix.stat arg in +- Printf.bprintf buf "\nstat_device %d\n" stat.Unix.st_dev; +- Printf.bprintf buf "stat_inode %d\n" stat.Unix.st_ino; ++ let stat = Unix.LargeFile.stat arg in ++ Printf.bprintf buf "\nstat_device %d\n" stat.Unix.LargeFile.st_dev; ++ Printf.bprintf buf "stat_inode %d\n" stat.Unix.LargeFile.st_ino; + + _s "" + ), "debug command (example: disk .)"; +@@ -2121,15 +2203,16 @@ + "debug_fileinfo", Arg_one (fun arg o -> + let buf = o.conn_buf in + (try +- let s = Unix.stat arg in +- Printf.bprintf buf "st_dev %d\n" s.Unix.st_dev; +- Printf.bprintf buf "st_ino %d\n" s.Unix.st_ino; +- Printf.bprintf buf "st_uid %d\n" s.Unix.st_uid; +- Printf.bprintf buf "st_gid %d\n" s.Unix.st_gid; +- Printf.bprintf buf "st_size %d\n" s.Unix.st_size; +- Printf.bprintf buf "st_atime %s\n" (Date.to_full_string s.Unix.st_atime); +- Printf.bprintf buf "st_mtime %s\n" (Date.to_full_string s.Unix.st_mtime); +- Printf.bprintf buf "st_ctime %s\n" (Date.to_full_string s.Unix.st_ctime); ++ let module U = Unix.LargeFile in ++ let s = U.stat arg in ++ Printf.bprintf buf "st_dev %d\n" s.U.st_dev; ++ Printf.bprintf buf "st_ino %d\n" s.U.st_ino; ++ Printf.bprintf buf "st_uid %d\n" s.U.st_uid; ++ Printf.bprintf buf "st_gid %d\n" s.U.st_gid; ++ Printf.bprintf buf "st_size %Ld\n" s.U.st_size; ++ Printf.bprintf buf "st_atime %s\n" (Date.to_full_string s.U.st_atime); ++ Printf.bprintf buf "st_mtime %s\n" (Date.to_full_string s.U.st_mtime); ++ Printf.bprintf buf "st_ctime %s\n" (Date.to_full_string s.U.st_ctime); + let user,group = Unix32.owner arg in + Printf.bprintf buf "username %s\n" user; + Printf.bprintf buf "groupname %s\n" group; +@@ -2337,9 +2420,8 @@ + ), "<dir> :\t\t\t\tunshare directory <dir>"; + + "upstats", Arg_none (fun o -> +- let buf = o.conn_buf in + if not (user2_can_view_uploads o.conn_user.ui_user) then +- print_command_result o buf "You are not allowed to see upload statistics" ++ print_command_result o "You are not allowed to see upload statistics" + else + begin + let list = ref [] in +@@ -2355,7 +2437,7 @@ + "links", Arg_none (fun o -> + let buf = o.conn_buf in + if not (user2_can_view_uploads o.conn_user.ui_user) then +- print_command_result o o.conn_buf "You are not allowed to see shared files list" ++ print_command_result o "You are not allowed to see shared files list" + else begin + + let list = ref [] in +@@ -2385,13 +2467,13 @@ + let buf = o.conn_buf in + + if not (user2_can_view_uploads o.conn_user.ui_user) then +- print_command_result o buf "You are not allowed to see uploaders list" ++ print_command_result o "You are not allowed to see uploaders list" + else begin + + let nuploaders = Intmap.length !uploaders in + if use_html_mods o then + begin +- let counter = ref 0 in ++ html_mods_cntr_init (); + Printf.bprintf buf "\\<div class=\\\"uploaders\\\"\\>"; + html_mods_table_one_row buf "uploadersTable" "uploaders" [ + ("", "srh", Printf.sprintf "Total upload slots: %d (%d) | Pending slots: %d\n" nuploaders +@@ -2415,8 +2497,10 @@ ] @ (if !!emule_mods_count then [( "0", "srh", "eMule MOD", "EM" )] else []) @ [ @@ -4407,16 +6003,26 @@ diff -u -r1.202 -r1.209 ( "0", "srh ar", "Slot kind", "Slot" ) ; ( "0", "srh", "Filename", "Filename" ) ]); -@@ -2432,7 +2446,7 @@ +@@ -2424,15 +2508,14 @@ + try + let i = client_info c in + if is_connected i.client_state then begin +- incr counter; + +- Printf.bprintf buf "\\<tr class=\\\"%s\\\" ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\" + title=\\\"[%d] Add as friend (avg: %.1f KB/s)\\\" + onMouseOver=\\\"mOvr(this);\\\" onMouseOut=\\\"mOut(this);\\\" onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"\\>" - ( if (!counter mod 2 == 0) then "dl-1" else "dl-2";) (client_num c) +- ( if (!counter mod 2 == 0) then "dl-1" else "dl-2";) (client_num c) - ( float_of_int (Int64.to_int i.client_uploaded / 1024) /. ++ (html_mods_cntr ()) (client_num c) + ( float_of_int (Int64.to_int i.client_session_uploaded / 1024) /. float_of_int (max 1 ((last_time ()) - i.client_connect_time)) ) (client_num c); -@@ -2455,8 +2469,10 @@ +@@ -2455,8 +2538,10 @@ ] @ (if !!emule_mods_count then [("", "sr", i.client_emulemod)] else []) @ [ @@ -4429,7 +6035,7 @@ diff -u -r1.202 -r1.209 (let text1, text2 = match client_slot c with | FriendSlot -> "Friend", "F" -@@ -2494,8 +2510,10 @@ +@@ -2494,8 +2579,10 @@ ] @ (if !!emule_mods_count then [( "0", "srh", "eMule MOD", "EM" )] else []) @ [ @@ -4442,7 +6048,22 @@ diff -u -r1.202 -r1.209 ( "0", "srh", "Filename", "Filename" ) ]); Intmap.iter (fun cnum c -> -@@ -2527,8 +2545,10 @@ +@@ -2503,12 +2590,11 @@ + try + let i = client_info c in + let ips,cc,cn = string_of_kind_geo i.client_kind in +- incr counter; + +- Printf.bprintf buf "\\<tr class=\\\"%s\\\" ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\" + title=\\\"Add as Friend\\\" onMouseOver=\\\"mOvr(this);\\\" onMouseOut=\\\"mOut(this);\\\" + onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"\\>" +- ( if (!counter mod 2 == 0) then "dl-1" else "dl-2";) cnum; ++ (html_mods_cntr ()) cnum; + + html_mods_td buf [ + ("", "sr", Printf.sprintf "%d" (client_num c)); ]; +@@ -2527,8 +2613,10 @@ ] @ (if !!emule_mods_count then [("", "sr", i.client_emulemod )] else []) @ [ @@ -4455,7 +6076,7 @@ diff -u -r1.202 -r1.209 ("", "sr", (match i.client_upload with Some f -> shorten f !!max_name_len | None -> "") ) ]); -@@ -2547,7 +2567,7 @@ +@@ -2547,7 +2635,7 @@ try let i = client_info c in client_print c o; @@ -4464,7 +6085,7 @@ diff -u -r1.202 -r1.209 match i.client_upload with Some cu -> Printf.bprintf buf " filename: %s\n" cu -@@ -2658,7 +2678,7 @@ +@@ -2658,7 +2746,7 @@ end ) !!files) args; files_to_cancel o @@ -4473,7 +6094,7 @@ diff -u -r1.202 -r1.209 "downloaders", Arg_none (fun o -> let buf = o.conn_buf in -@@ -2679,8 +2699,10 @@ +@@ -2679,8 +2767,10 @@ ( "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 []) @ [ @@ -4486,7 +6107,7 @@ diff -u -r1.202 -r1.209 ( "0", "srh", "Filename", "Filename" ) ]); let counter = ref 0 in -@@ -2725,7 +2747,7 @@ +@@ -2725,7 +2815,7 @@ if (as_file_impl file).impl_file_num = num then file_pause file o.conn_user.ui_user ) !!files) args; "" @@ -4495,7 +6116,7 @@ diff -u -r1.202 -r1.209 "resume", Arg_multiple (fun args o -> if args = ["all"] && user2_is_admin o.conn_user.ui_user then -@@ -2739,7 +2761,7 @@ +@@ -2739,7 +2829,7 @@ if (as_file_impl file).impl_file_num = num then file_resume file o.conn_user.ui_user ) !!files) args; "" @@ -4504,43 +6125,369 @@ diff -u -r1.202 -r1.209 "release", Arg_one (fun arg o -> let num = int_of_string arg in -@@ -3080,7 +3102,7 @@ +@@ -2792,10 +2882,10 @@ + Printf.bprintf buf "\\<div class=\\\"sourcesTable al\\\"\\>\\<table cellspacing=0 cellpadding=0\\> + \\<tr\\>\\<td\\> + \\<table cellspacing=0 cellpadding=0 width=100%%\\>\\<tr\\> +- \\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"files\\\"\\>Display all files\\</a\\>\\</td\\> +- \\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"submit?q=verify_chunks+%d\\\"\\>Verify chunks\\</a\\>\\</td\\> +- \\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"preview_download?q=%d\\\"\\>Preview\\</a\\>\\</td\\> +- \\<td nowrap class=\\\"fbig pr\\\"\\>\\<a href=\\\"javascript:window.location.reload()\\\"\\>Reload\\</a\\>\\</td\\> ++ \\<td nowrap class=\\\"fbig\\\"\\>\\<a onclick=\\\"javascript:window.location.href='files'\\\"\\>Display all files\\</a\\>\\</td\\> ++ \\<td nowrap class=\\\"fbig\\\"\\>\\<a onClick=\\\"javascript:parent.fstatus.location.href='submit?q=verify_chunks+%d'\\\"\\>Verify chunks\\</a\\>\\</td\\> ++ \\<td nowrap class=\\\"fbig\\\"\\>\\<a onClick=\\\"javascript:parent.fstatus.location.href='preview_download?q=%d'\\\"\\>Preview\\</a\\>\\</td\\> ++ \\<td nowrap class=\\\"fbig pr\\\"\\>\\<a onclick=\\\"javascript:window.location.reload()\\\"\\>Reload\\</a\\>\\</td\\> + \\<td class=downloaded width=100%%\\>\\</td\\> + \\</tr\\>\\</table\\> + \\</td\\>\\</tr\\> +@@ -2872,50 +2962,47 @@ + register_commands "Driver/Users" [ + + "useradd", Arg_two (fun user pass o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user + || o.conn_user.ui_user.user_name = user then + if user2_user_exists user then + begin + user2_user_set_password (user2_user_find user) pass; +- print_command_result o buf (Printf.sprintf "Password of user %s changed" user) ++ print_command_result o (Printf.sprintf "Password of user %s changed" user) + end + else + begin + user2_user_add user (Md4.string pass) (); +- print_command_result o buf (Printf.sprintf "User %s added" user) ++ print_command_result o (Printf.sprintf "User %s added" user) + end + else +- print_command_result o buf "You are not allowed to add users"; ++ print_command_result o "You are not allowed to add users"; + _s "" + ), "<user> <passwd> :\t\tadd new mldonkey user/change user password"; + + "userdel", Arg_one (fun user o -> +- let buf = o.conn_buf in + if user <> o.conn_user.ui_user.user_name then + if user2_is_admin o.conn_user.ui_user then + if user = admin_user.user_name then +- print_command_result o buf "User 'admin' can not be removed" ++ print_command_result o "User 'admin' can not be removed" + else + try + let u = user2_user_find user in + let n = user2_num_user_dls u in +- if n <> 0 then print_command_result o buf ++ if n <> 0 then print_command_result o + (Printf.sprintf "User %s has %d downloads, can not delete" user n) + else + user2_user_remove user; +- print_command_result o buf (Printf.sprintf "User %s removed" user) ++ print_command_result o (Printf.sprintf "User %s removed" user) + with +- Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + else +- print_command_result o buf "You are not allowed to remove users" ++ print_command_result o "You are not allowed to remove users" else - print_command_result o buf "You are not allowed to add a group"; +- print_command_result o buf "You can not remove yourself"; ++ print_command_result o "You can not remove yourself"; + _s "" + ), "<user> :\t\t\tremove a mldonkey user"; + + "usergroupadd", Arg_two (fun user group o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then + begin + try +@@ -2924,18 +3011,17 @@ + try + let g = user2_group_find group in + user2_user_add_group u g; +- print_command_result o buf (Printf.sprintf "Added group %s to user %s" g.group_name u.user_name) +- with Not_found -> print_command_result o buf (Printf.sprintf "Group %s does not exist" group) ++ print_command_result o (Printf.sprintf "Added group %s to user %s" g.group_name u.user_name) ++ with Not_found -> print_command_result o (Printf.sprintf "Group %s does not exist" group) + end +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + end + else +- print_command_result o buf "You are not allowed to add groups to a user"; ++ print_command_result o "You are not allowed to add groups to a user"; + _s "" + ), "<user> <group> :\t\tadd a group to a mldonkey user"; + + "usergroupdel", Arg_two (fun user group o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user + || o.conn_user.ui_user.user_name = user then + begin +@@ -2945,10 +3031,10 @@ + try + let g = user2_group_find group in + if not (List.mem g u.user_groups) then +- print_command_result o buf (Printf.sprintf "User %s is not member of group %s" user group) ++ print_command_result o (Printf.sprintf "User %s is not member of group %s" user group) + else + if Some g = u.user_default_group then +- print_command_result o buf (Printf.sprintf "Group %s is default group of user %s, can not remove. Use command userdgroup to change default_group." group user) ++ print_command_result o (Printf.sprintf "Group %s is default group of user %s, can not remove. Use command userdgroup to change default_group." group user) + else + begin + let counter = ref 0 in +@@ -2960,23 +3046,22 @@ + end + ) !!files; + user2_user_remove_group (user2_user_find user) (user2_group_find group); +- print_command_result o buf (Printf.sprintf "Removed group %s from user %s%s" ++ print_command_result o (Printf.sprintf "Removed group %s from user %s%s" + group user + (if !counter = 0 then "" else Printf.sprintf ", changed file_group of %d file%s to default_group %s" + !counter (Printf2.print_plural_s !counter) (user2_print_group u.user_default_group))) + end +- with Not_found -> print_command_result o buf (Printf.sprintf "Group %s does not exist" group) ++ with Not_found -> print_command_result o (Printf.sprintf "Group %s does not exist" group) + end +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + end + + else +- print_command_result o buf "You are not allowed to remove groups from a user"; ++ print_command_result o "You are not allowed to remove groups from a user"; + _s "" + ), "<user> <group> :\t\tremove a group from a mldonkey user"; + + "userdgroup", Arg_two (fun user group o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user + || o.conn_user.ui_user.user_name = user then + begin +@@ -2994,76 +3079,71 @@ + if update_dgroup () then + begin + user2_user_set_default_group u g; +- print_command_result o buf (Printf.sprintf "Changed default group of user %s to group %s" u.user_name (user2_print_user_default_group u)) ++ print_command_result o (Printf.sprintf "Changed default group of user %s to group %s" u.user_name (user2_print_user_default_group u)) + end +- else print_command_result o buf (Printf.sprintf "User %s is not member of group %s" u.user_name group) +- with Not_found -> print_command_result o buf (Printf.sprintf "Group %s does not exist" group) ++ else print_command_result o (Printf.sprintf "User %s is not member of group %s" u.user_name group) ++ with Not_found -> print_command_result o (Printf.sprintf "Group %s does not exist" group) + end +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + end + else +- print_command_result o buf "You are not allowed to change default group"; ++ print_command_result o "You are not allowed to change default group"; + _s "" + ), "<user> <group|None> :\tchange user default group"; + + "passwd", Arg_one (fun passwd o -> +- let buf = o.conn_buf in + begin + try + let u = user2_user_find o.conn_user.ui_user.user_name in + user2_user_set_password u passwd; +- print_command_result o buf (Printf.sprintf "Password of user %s changed" u.user_name) +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" o.conn_user.ui_user.user_name) ++ print_command_result o (Printf.sprintf "Password of user %s changed" u.user_name) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" o.conn_user.ui_user.user_name) + end; + _s "" + ), "<passwd> :\t\t\tchange own password"; + + "usermail", Arg_two (fun user mail o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user + || o.conn_user.ui_user.user_name = user then + begin + try + let u = user2_user_find user in + user2_user_set_mail u mail; +- print_command_result o buf (Printf.sprintf "User %s has new mail %s" user mail) +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ print_command_result o (Printf.sprintf "User %s has new mail %s" user mail) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + end +- else print_command_result o buf "You are not allowed to change mail addresses"; ++ else print_command_result o "You are not allowed to change mail addresses"; + _s "" + ), "<user> <mail> :\t\tchange user mail address"; + + "userdls", Arg_two (fun user dls o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then + begin + try + let u = user2_user_find user in + user2_user_set_dls u (int_of_string dls); +- print_command_result o buf (Printf.sprintf "User %s has now %s downloads allowed" user (user2_print_user_dls (user2_user_find user))) +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ print_command_result o (Printf.sprintf "User %s has now %s downloads allowed" user (user2_print_user_dls (user2_user_find user))) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + end +- else print_command_result o buf "You are not allowed to change this value"; ++ else print_command_result o "You are not allowed to change this value"; + _s "" + ), "<user> <num> :\t\t\tchange number of allowed concurrent downloads"; + + "usercommit", Arg_two (fun user dir o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user + || o.conn_user.ui_user.user_name = user then + begin + try + let u = user2_user_find user in + user2_user_set_commit_dir u dir; +- print_command_result o buf (Printf.sprintf "User %s has new commit dir %s" u.user_name u.user_commit_dir) +- with Not_found -> print_command_result o buf (Printf.sprintf "User %s does not exist" user) ++ print_command_result o (Printf.sprintf "User %s has new commit dir %s" u.user_name u.user_commit_dir) ++ with Not_found -> print_command_result o (Printf.sprintf "User %s does not exist" user) + end +- else print_command_result o buf "You are not allowed to change this value"; ++ else print_command_result o "You are not allowed to change this value"; + _s "" + ), "<user> <dir> :\t\tchange user specific commit directory"; + + "groupadd", Arg_two (fun group admin o -> +- let buf = o.conn_buf in + let g_admin = + try + bool_of_string admin +@@ -3071,19 +3151,18 @@ + in + if user2_is_admin o.conn_user.ui_user then + if user2_group_exists group then +- print_command_result o buf (Printf.sprintf "Group %s already exists" group) ++ print_command_result o (Printf.sprintf "Group %s already exists" group) + else + begin + user2_group_add group g_admin; +- print_command_result o buf (Printf.sprintf "Group %s added" group) ++ print_command_result o (Printf.sprintf "Group %s added" group) + end + else +- print_command_result o buf "You are not allowed to add a group"; ++ print_command_result o "You are not allowed to add a group"; _s "" - ), "<group> <admin: true | false>: add new mldonkey group"; + ), "<group> <admin: true|false> :\tadd new mldonkey group"; "groupdel", Arg_one (fun group o -> - let buf = o.conn_buf in -@@ -3345,22 +3367,22 @@ +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then + begin + try +@@ -3091,46 +3170,45 @@ + let g_dls = user2_num_group_dls g in + let g_mem = user2_num_group_members g in + if g_dls <> 0 then +- print_command_result o buf ++ print_command_result o + (Printf.sprintf "Can not remove group %s, it has %d download%s" + group g_dls (Printf2.print_plural_s g_dls)) + else + if g_mem <> 0 then +- print_command_result o buf ++ print_command_result o + (Printf.sprintf "Can not remove group %s, it has %d member%s" + group g_mem (Printf2.print_plural_s g_mem)) + else + if g.group_name = system_user_default_group.group_name then +- print_command_result o buf (Printf.sprintf "Can not remove system group %s" group) ++ print_command_result o (Printf.sprintf "Can not remove system group %s" group) + else + begin + user2_group_remove g; +- print_command_result o buf (Printf.sprintf "Removed group %s" group) ++ print_command_result o (Printf.sprintf "Removed group %s" group) + end +- with Not_found -> print_command_result o buf (Printf.sprintf "Group %s does not exist" group) ++ with Not_found -> print_command_result o (Printf.sprintf "Group %s does not exist" group) + end + else +- print_command_result o buf "You are not allowed to remove users"; ++ print_command_result o "You are not allowed to remove users"; + _s "" + ), "<group> :\t\t\tremove an unused mldonkey group"; + + "groupadmin", Arg_two (fun group admin o -> +- let buf = o.conn_buf in + if user2_is_admin o.conn_user.ui_user then + begin + try + let g = user2_group_find group in + if g.group_name = system_user_default_group.group_name then +- print_command_result o buf (Printf.sprintf "Can not change state of system group %s" group) ++ print_command_result o (Printf.sprintf "Can not change state of system group %s" group) + else + begin + user2_group_admin g (bool_of_string admin); +- print_command_result o buf (Printf.sprintf "Changed admin status of group %s to %b" g.group_name g.group_admin) ++ print_command_result o (Printf.sprintf "Changed admin status of group %s to %b" g.group_name g.group_admin) + end +- with Not_found -> print_command_result o buf (Printf.sprintf "Group %s does not exist" group) ++ with Not_found -> print_command_result o (Printf.sprintf "Group %s does not exist" group) + end + else +- print_command_result o buf "You are not allowed to change group admin status"; ++ print_command_result o "You are not allowed to change group admin status"; + _s "" + ), "<group> <true|false> :\tchange group admin status"; + +@@ -3163,12 +3241,11 @@ + ( "0", "srh ar", "Download quota", "Max DLs" ) ; + ( "0", "srh ar", "Download count", "DLs" ) ]; + +- let counter = ref 0 in ++ html_mods_cntr_init (); + user2_users_iter (fun user -> +- incr counter; + let u_dls = user2_num_user_dls user in +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>" +- (if !counter mod 2 == 0 then "dl-1" else "dl-2"); ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" ++ (html_mods_cntr ()); + if user <> admin_user && (u_dls = 0) then Printf.bprintf buf + "\\<td title=\\\"Click to remove user\\\" + onMouseOver=\\\"mOvr(this);\\\" +@@ -3343,24 +3420,24 @@ + "Downloads"; + |] (List.rev !list); end - end else print_command_result o buf "You are not allowed to list users"; +- end else print_command_result o buf "You are not allowed to list users"; ++ end else print_command_result o "You are not allowed to list users"; _s "" - ), "\t\t\t\t\tprint users"; + ), ":\t\t\t\t\tprint users"; "whoami", Arg_none (fun o -> - print_command_result o o.conn_buf o.conn_user.ui_user.user_name; +- print_command_result o o.conn_buf o.conn_user.ui_user.user_name; ++ print_command_result o o.conn_user.ui_user.user_name; _s "" - ), "\t\t\t\t\tprint logged-in user name"; + ), ":\t\t\t\tprint logged-in user name"; "groups", Arg_none (fun o -> - print_command_result o o.conn_buf (user2_print_user_groups " " o.conn_user.ui_user); +- print_command_result o o.conn_buf (user2_print_user_groups " " o.conn_user.ui_user); ++ print_command_result o (user2_print_user_groups " " o.conn_user.ui_user); _s "" - ), "\t\t\t\t\tprint groups of logged-in user"; + ), ":\t\t\t\tprint groups of logged-in user"; "dgroup", Arg_none (fun o -> - print_command_result o o.conn_buf (user2_print_user_default_group o.conn_user.ui_user); +- print_command_result o o.conn_buf (user2_print_user_default_group o.conn_user.ui_user); ++ print_command_result o (user2_print_user_default_group o.conn_user.ui_user); _s "" - ), "\t\t\t\t\tprint default group of logged-in user"; + ), ":\t\t\t\tprint default group of logged-in user"; "chgrp", Arg_two (fun group filenum o -> let num = int_of_string filenum in -@@ -3368,8 +3390,13 @@ +@@ -3368,8 +3445,13 @@ let file = file_find num in if String.lowercase group = "none" then begin @@ -4549,43 +6496,146 @@ diff -u -r1.202 -r1.209 + if user2_allow_file_admin file o.conn_user.ui_user then + begin + set_file_group file None; -+ print_command_result o o.conn_buf (Printf.sprintf (_b "Changed group of download %d to %s") num group) ++ print_command_result o (Printf.sprintf (_b "Changed group of download %d to %s") num group) + end + else -+ print_command_result o o.conn_buf (Printf.sprintf (_b "You are not allowed to change group of download %d to %s") num group) ++ print_command_result o (Printf.sprintf (_b "You are not allowed to change group of download %d to %s") num group) end else begin -@@ -3401,7 +3428,19 @@ +@@ -3379,13 +3461,13 @@ + List.mem g (file_owner file).user_groups then + begin + set_file_group file (Some g); +- print_command_result o o.conn_buf (Printf.sprintf (_b "Changed group of download %d to %s") num group) ++ print_command_result o (Printf.sprintf (_b "Changed group of download %d to %s") num group) + end + else +- print_command_result o o.conn_buf (Printf.sprintf (_b "You are not allowed to change group of download %d to %s") num group) +- with Not_found -> print_command_result o o.conn_buf (Printf.sprintf (_b "Group %s not found") group) ++ print_command_result o (Printf.sprintf (_b "You are not allowed to change group of download %d to %s") num group) ++ with Not_found -> print_command_result o (Printf.sprintf (_b "Group %s not found") group) + end +- with Not_found -> print_command_result o o.conn_buf (Printf.sprintf (_b "File %d not found") num) ++ with Not_found -> print_command_result o (Printf.sprintf (_b "File %d not found") num) + end; + _s "" + ), "<group> <num> :\t\t\tchange group of download <num> to <group>, use group = none for private file"; +@@ -3401,13 +3483,25 @@ if user2_allow_file_admin file o.conn_user.ui_user then begin set_file_owner file u; - print_command_result o o.conn_buf (Printf.sprintf (_b "Changed owner of download %d to %s") num user) + match file_group file with + | None -> -+ print_command_result o o.conn_buf (Printf.sprintf (_b "Changed owner of download %d to %s") num user) ++ print_command_result o (Printf.sprintf (_b "Changed owner of download %d to %s") num user) + | Some g -> + if List.mem g u.user_groups then -+ print_command_result o o.conn_buf (Printf.sprintf (_b "Changed owner of download %d to %s") num user) ++ print_command_result o (Printf.sprintf (_b "Changed owner of download %d to %s") num user) + else + begin + set_file_group file u.user_default_group; -+ print_command_result o o.conn_buf (Printf.sprintf ++ print_command_result o (Printf.sprintf + (_b "owner %s is not member of file_group %s, changing file_group to user_default_group %s") + user g.group_name (user2_print_user_default_group u)) + end end else - print_command_result o o.conn_buf (Printf.sprintf (_b "You are not allowed to change owner of download %d to %s") num user) +- print_command_result o o.conn_buf (Printf.sprintf (_b "You are not allowed to change owner of download %d to %s") num user) +- with Not_found -> print_command_result o o.conn_buf (Printf.sprintf (_b "User %s not found") user) ++ print_command_result o (Printf.sprintf (_b "You are not allowed to change owner of download %d to %s") num user) ++ with Not_found -> print_command_result o (Printf.sprintf (_b "User %s not found") user) + end +- with Not_found -> print_command_result o o.conn_buf (Printf.sprintf (_b "File %d not found") num) ++ with Not_found -> print_command_result o (Printf.sprintf (_b "File %d not found") num) + end; + _s "" + ), "<user> <num> :\t\t\tchange owner of download <num> to <user>"; +Index: src/daemon/driver/driverControlers.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverControlers.ml,v +retrieving revision 1.93 +retrieving revision 1.96 +diff -u -r1.93 -r1.96 +--- src/daemon/driver/driverControlers.ml 19 Nov 2006 23:03:42 -0000 1.93 ++++ src/daemon/driver/driverControlers.ml 28 Jan 2007 20:39:59 -0000 1.96 +@@ -1493,25 +1493,6 @@ + read_theme_page this_page else + if !!html_mods then !!CommonMessages.download_html_js_mods0 + else !!CommonMessages.download_html_js_old) +- | "porttest" -> +- html_open_page buf t r true; +- let age time = +- Date.time_to_string (BasicSocket.last_time () - time) "verbose" in +- networks_iter (fun n -> +- let result = +- match network_porttest_result n with +- PorttestNotAvailable -> None +- | PorttestNotStarted -> Some "porttest not started" +- | PorttestInProgress time -> +- Some (Printf.sprintf "porttest started %s ago" (age time)) +- | PorttestResult (time, s) -> +- Some (Printf.sprintf "porttest finished %s ago, %s" (age time) s) +- in +- (match result with +- None -> () +- | Some result -> +- Printf.bprintf buf "%s:<br> %s<br>\n" n.network_name result)); +- Printf.bprintf buf "<br><br><a href=\"porttest\">Reload</a>" + | _ -> raise Not_found + with + | Not_found -> +Index: src/daemon/driver/driverGraphics_gd.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverGraphics_gd.ml,v +retrieving revision 1.3 +retrieving revision 1.4 +diff -u -r1.3 -r1.4 +--- src/daemon/driver/driverGraphics_gd.ml 28 Nov 2006 23:15:21 -0000 1.3 ++++ src/daemon/driver/driverGraphics_gd.ml 6 Jan 2007 17:31:48 -0000 1.4 +@@ -264,7 +264,7 @@ + in + let day_string n = + let time = Unix.localtime (basetime -. float_of_int(n * my_time / x_divisions ())) in +- Printf.sprintf "%02d.%02d." time.Unix.tm_mday time.Unix.tm_mon ++ Printf.sprintf "%02d.%02d." time.Unix.tm_mday (time.Unix.tm_mon + 1) + in + if show_days then + begin Index: src/daemon/driver/driverInteractive.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml,v retrieving revision 1.118 -retrieving revision 1.122 -diff -u -r1.118 -r1.122 +retrieving revision 1.126 +diff -u -r1.118 -r1.126 --- src/daemon/driver/driverInteractive.ml 28 Nov 2006 23:17:31 -0000 1.118 -+++ src/daemon/driver/driverInteractive.ml 3 Dec 2006 20:57:56 -0000 1.122 -@@ -1115,7 +1115,8 @@ ++++ src/daemon/driver/driverInteractive.ml 6 Feb 2007 22:26:58 -0000 1.126 +@@ -391,13 +391,10 @@ + + let print_table_html_mods buf lines = + +- let counter = ref 0 in ++ html_mods_cntr_init (); + + List.iter (fun line -> +- if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr class=dl-1" +- else Printf.bprintf buf "\\<tr class=dl-2"; +- incr counter; +- ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"" (html_mods_cntr ()); + Array.iter (fun data -> + Printf.bprintf buf "%s" data; + ) line; +@@ -668,7 +665,7 @@ + (List.length guifiles) (size_of_int64 !tdl) (size_of_int64 !tsize) (!trate /. 1024.) + (let unread = ref 0 in + Fifo.iter (fun (t,i,num,n,s) -> if t > !last_message_log then incr unread) chat_message_fifo; +-if !unread > 0 then Printf.sprintf "\\<td class=downloaded title=\\\"%d unread messages\\\"\\>\\<a onClick=\\\"mSub('fstatus','version');mSub('output','message')\\\"\\>(+%d)\\</a\\>\\ \\</td\\>" !unread !unread else ""); ++if !unread > 0 then Printf.sprintf "\\<td onMouseOver=\\\"mOvr(this);\\\" onMouseOut=\\\"mOut(this);\\\" class=downloaded title=\\\"%d unread messages\\\"\\>\\<a onClick=\\\"mSub('fstatus','version');mSub('output','message')\\\"\\>(+%d)\\</a\\>\\ \\</td\\>" !unread !unread else ""); + + if !!html_mods_vd_network then Printf.bprintf buf + "\\<td title=\\\"Sort by network\\\" class=dlheader\\>\\<input style=\\\"padding-left: 0px; padding-right: 0px;\\\" class=headbutton type=submit value=N name=sortby\\>\\</td\\>"; +@@ -1115,7 +1112,8 @@ if o.conn_output <> HTML && !!improved_telnet then begin @@ -4595,7 +6645,7 @@ diff -u -r1.118 -r1.122 simple_print_file_list false buf list o end else -@@ -1124,29 +1125,37 @@ +@@ -1124,29 +1122,37 @@ let sorter = match o.conn_sortvd with @@ -4653,7 +6703,27 @@ diff -u -r1.118 -r1.122 with _ -> list in simple_print_file_list false buf list o -@@ -1259,7 +1268,7 @@ +@@ -1191,6 +1197,7 @@ + let counter = ref 0 in + if use_html_mods o then + begin ++ html_mods_cntr_init (); + if !!html_mods_use_js_tooltips then Printf.bprintf buf "\\<div id=\\\"object1\\\" style=\\\"position:absolute; background-color:#FFFFDD;color:black;border-color:black;border-width:20px;font-size:8pt; visibility:visible; left:25px; top:-100px; z-index:+1\\\" onmouseover=\\\"overdiv=1;\\\" onmouseout=\\\"overdiv=0; setTimeout(\\\'hideLayer()\\\',1000)\\\"\\>\\ \\</div\\>\n"; + html_mods_table_header_colspan buf "resultsTable" "results" [ + ( "1", "0", "srh", "Network", "Network" ) ; +@@ -1211,10 +1218,7 @@ + if !counter >= !!max_displayed_results then raise Exit; + + if use_html_mods o then +- begin +- if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr class=\\\"dl-1\\\"\\>" +- else Printf.bprintf buf "\\<tr class=\\\"dl-2\\\"\\>"; +- end; ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); + + user.ui_last_results <- (!counter, rs) :: user.ui_last_results; + let network_name = +@@ -1259,7 +1263,7 @@ let nl = ref false in List.iter (fun t -> match t.tag_name with @@ -4662,7 +6732,7 @@ diff -u -r1.118 -r1.122 | _ -> Buffer.add_string buf ((if !nl then "<br>" else begin nl := true;"" end) ^ escaped_string_of_field t ^ ": " ^ get_tag_value t); -@@ -1275,7 +1284,7 @@ +@@ -1275,7 +1279,7 @@ let nl = ref false in List.iter (fun t -> match t.tag_name with @@ -4671,7 +6741,7 @@ diff -u -r1.118 -r1.122 | _ -> Buffer.add_string buf ((if !nl then "\n" else begin nl := true;"" end) ^ "|| (" ^ -@@ -1331,8 +1340,8 @@ +@@ -1331,8 +1335,8 @@ let cformat = ref "" in List.iter (fun t -> (match t.tag_name with @@ -4682,7 +6752,7 @@ diff -u -r1.118 -r1.122 | Field_Availability -> cavail := get_tag_value t | Field_Completesources -> csource := get_tag_value t | Field_Length -> clength := get_tag_value t -@@ -1383,9 +1392,9 @@ +@@ -1383,9 +1387,9 @@ | Field_Format | Field_Bitrate (* TODO : "urn" shouldn't be some kind of Field_Uid of Gnutella ? *) @@ -4694,7 +6764,7 @@ diff -u -r1.118 -r1.122 | _ -> Buffer.add_string buf ("\\<span title=\\\"" ^ get_tag_value t ^ "\\\"\\>(" ^ -@@ -1490,9 +1499,9 @@ +@@ -1490,9 +1494,9 @@ user.ui_last_results <- (!counter, rs) :: user.ui_last_results; files := [| @@ -4705,7 +6775,7 @@ diff -u -r1.118 -r1.122 ( let names = r.result_names in -@@ -1704,8 +1713,8 @@ +@@ -1704,8 +1708,8 @@ Intmap.iter (fun r_num (avail,rs) -> let r = IndexedResults.get_result rs in results := (rs, r, !avail) :: !results) s.search_results; @@ -4716,7 +6786,94 @@ diff -u -r1.118 -r1.122 ) !results in Printf.bprintf buf "Result of search %d\n" s.search_num; -@@ -2448,7 +2457,9 @@ +@@ -1877,7 +1881,7 @@ + ); + tack list + ( +- "Build on:\t", ++ "Built on:\t", + Autoconf.build_system ^ " (" ^ Unix2.endianness () ^ ")" ^ + (if Autoconf.glibc_version = "" then "" + else +@@ -1941,12 +1945,11 @@ + ( "0", "srh", "", "" ) ] + else + Printf.bprintf buf "\n\t--Buildinfo--\n"; +- let counter = ref 0 in ++ html_mods_cntr_init (); + List.iter (fun (desc, text) -> +- incr counter; + if html then +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" +- (if !counter mod 2 = 0 then "dl-1" else "dl-2") desc text ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" ++ (html_mods_cntr ()) desc text + else + Printf.bprintf buf "%s %s\n" desc text; + ) list; +@@ -2036,10 +2039,11 @@ + tack list + ( + "", +- Printf.sprintf "\t\t max_string_length: %d - word_size: %d - max_array_length: %d" ++ Printf.sprintf "\t\t max_string_length: %d - word_size: %d - max_array_length: %d - max_int: %d" + Sys.max_string_length + Sys.word_size + Sys.max_array_length ++ Pervasives.max_int + ); + tack list + ( +@@ -2060,12 +2064,11 @@ + ( "0", "srh", "", "" ) ] + else + Printf.bprintf buf "\n\t--Runinfo--\n"; +- let counter = ref 0 in ++ html_mods_cntr_init (); + List.iter (fun (desc, text) -> +- incr counter; + if html then +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" +- (if !counter mod 2 = 0 then "dl-1" else "dl-2") desc text ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" ++ (html_mods_cntr ()) desc text + else + Printf.bprintf buf "%s %s\n" desc text; + ) list; +@@ -2136,7 +2139,7 @@ + let fill_dir_line = String.make (!len_dir - 9) '-' in + let fill_strategy = String.make (!len_strategy - 4) ' ' in + let fill_strategy_line = String.make (!len_strategy - 4) '-' in +- let counter = ref 0 in ++ html_mods_cntr_init (); + if html then + html_mods_table_header buf "sharesTable" "shares" [ + ( "0", "srh", "Directory", "Directory" ) ; +@@ -2154,7 +2157,6 @@ + fill_dir_line fill_strategy_line; + end; + List.iter (fun (dir, strategy) -> +- incr counter; + let diskused = + match Unix32.diskused dir with + | None -> Printf.sprintf "---" +@@ -2172,11 +2174,10 @@ + in + let filesystem = Unix32.filesystem dir in + if html then +- begin +- Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" +- (if !counter mod 2 = 0 then "dl-1" else "dl-2") +- dir strategy diskused diskfree percentfree filesystem +- end ++ Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\> ++ \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr ar\\\"\\>%s\\</td\\> ++ \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" ++ (html_mods_cntr ()) dir strategy diskused diskfree percentfree filesystem + else + Printf.bprintf buf "%-*s|%-*s|%8s|%8s|%5s|%-s\n" + (max !len_dir (!len_dir - String.length dir)) dir +@@ -2448,7 +2449,9 @@ ( "0", "srh", "Preview", "P" ) ; ( "0", "srh", "Filename", "Filename" ); ( "0", "srh", "Statistic links", "Stats" ); @@ -4727,7 +6884,7 @@ diff -u -r1.118 -r1.122 else begin Printf.bprintf buf " Requests | Bytes | Uploaded | File\n"; -@@ -2456,10 +2467,10 @@ +@@ -2456,10 +2459,10 @@ end; html_mods_cntr_init (); @@ -4742,7 +6899,7 @@ diff -u -r1.118 -r1.122 ) list in List.iter (fun impl -> -@@ -2474,8 +2485,9 @@ +@@ -2474,8 +2477,9 @@ (if !!html_mods_use_js_tooltips then Printf.bprintf buf " onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>%s%s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\" onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>" (Http_server.html_real_escaped (Filename.basename (Charset.to_utf8 impl.impl_shared_codedname))) @@ -4754,7 +6911,7 @@ diff -u -r1.118 -r1.122 | Some magic -> "File type: " ^ (Http_server.html_real_escaped magic) ^ "<br>") (if impl.impl_shared_servers = [] then "" else Printf.sprintf "<br>Published on %d %s<br>%s" -@@ -2497,7 +2509,6 @@ +@@ -2497,7 +2501,6 @@ let uploaded = Int64.to_float impl.impl_shared_uploaded in let size = Int64.to_float impl.impl_shared_size in @@ -4762,7 +6919,7 @@ diff -u -r1.118 -r1.122 html_mods_td buf [ ("", "sr ar", Printf.sprintf "%d" impl.impl_shared_requests); ("", "sr ar", size_of_int64 impl.impl_shared_uploaded); -@@ -2515,7 +2526,9 @@ +@@ -2515,7 +2518,9 @@ (Md4.to_string impl.impl_shared_id) "T1" (Md4.to_string impl.impl_shared_id) "T2" (Md4.to_string impl.impl_shared_id) "B")); @@ -4773,14 +6930,61 @@ diff -u -r1.118 -r1.122 Printf.bprintf buf "\\</tr\\>\n"; end else +Index: src/daemon/driver/driverInterface.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInterface.ml,v +retrieving revision 1.61 +retrieving revision 1.63 +diff -u -r1.61 -r1.63 +--- src/daemon/driver/driverInterface.ml 26 Nov 2006 13:54:09 -0000 1.61 ++++ src/daemon/driver/driverInterface.ml 25 Jan 2007 13:29:05 -0000 1.63 +@@ -470,15 +470,13 @@ + gui.gui_events.gui_new_events <- ev :: gui.gui_events.gui_new_events + ) console_messages; + +- if user2_is_admin gui.gui_conn.conn_user.ui_user then + gui_send gui ( +- P.Options_info (simple_options "" downloads_ini)); ++ P.Options_info (simple_options "" downloads_ini (user2_is_admin gui.gui_conn.conn_user.ui_user))); + +- if user2_is_admin gui.gui_conn.conn_user.ui_user then + networks_iter_all (fun r -> + List.iter (fun opfile -> + let prefix = r.network_shortname ^ "-" in +- let args = simple_options prefix opfile in ++ let args = simple_options prefix opfile (user2_is_admin gui.gui_conn.conn_user.ui_user) in + gui_send gui (P.Options_info args)) r.network_config_file); + + (* Options panels defined in downloads.ini *) +@@ -1091,8 +1089,18 @@ + let s = server_find num in + server_rename s name + | P.ServerSetPreferred (num, preferred) -> +- let s = server_find num in +- server_set_preferred s preferred ++ if user2_is_admin gui.gui_conn.conn_user.ui_user then ++ server_set_preferred (server_find num) preferred ++ else ++ begin ++ let o = gui.gui_conn in ++ let buf = o.conn_buf in ++ Buffer.reset buf; ++ Buffer.add_string buf "\nYou are not allowed to change preferred status\n"; ++ gui_send gui (P.Console ( ++ DriverControlers.dollar_escape o false ++ (Buffer.contents buf))) ++ end + + with + Failure s -> Index: src/daemon/driver/driverMain.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverMain.ml,v retrieving revision 1.133 -retrieving revision 1.134 -diff -u -r1.133 -r1.134 +retrieving revision 1.135 +diff -u -r1.133 -r1.135 --- src/daemon/driver/driverMain.ml 28 Nov 2006 23:15:21 -0000 1.133 -+++ src/daemon/driver/driverMain.ml 8 Dec 2006 12:26:25 -0000 1.134 ++++ src/daemon/driver/driverMain.ml 17 Jan 2007 18:53:28 -0000 1.135 @@ -54,7 +54,6 @@ let minute_timer () = @@ -4789,7 +6993,31 @@ diff -u -r1.133 -r1.134 CommonUploads.upload_credit_timer (); CommonInteractive.force_download_quotas (); CommonResult.dummy_result.result_time <- last_time (); -@@ -446,6 +445,10 @@ +@@ -306,6 +305,23 @@ + "-pid", Arg.String (fun s -> pid := s; + ), + _s ": directory for pid file"; ++ "-useradd", Arg.Rest (fun s -> ++ (match String2.split s ' ' with ++ | user :: pass :: _ -> ++ if user2_user_exists user then ++ begin ++ user2_user_set_password (user2_user_find user) pass; ++ Printf.printf "%sPassword of user %s changed\n%!" (log_time ()) user ++ end ++ else ++ begin ++ user2_user_add user (Md4.Md4.string pass) (); ++ Printf.printf "%sUser %s added\n%!" (log_time ()) user ++ end; ++ Options.save_with_help_private users_ini; ++ Printf.printf "%sSaved changes to users.ini\n%!" (log_time ()) ++ | _ -> raise (Arg.Bad "invalid syntax")); ++ exit 0), _s "\"<user> <pass>\" : create user/change password"; + ] @ + !more_args + @ +@@ -446,6 +462,10 @@ add_infinite_timer 0.1 CommonUploads.upload_download_timer; add_infinite_timer !!buffer_writes_delay (fun _ -> Unix32.flush ()); @@ -4800,6 +7028,100 @@ diff -u -r1.133 -r1.134 history_timeflag := (Unix.time()); update_download_history (); update_upload_history (); +Index: src/gtk/gui/gui_friends.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/gtk/gui/gui_friends.ml,v +retrieving revision 1.7 +retrieving revision 1.8 +diff -u -r1.7 -r1.8 +--- src/gtk/gui/gui_friends.ml 28 Nov 2006 12:58:10 -0000 1.7 ++++ src/gtk/gui/gui_friends.ml 8 Jan 2007 14:07:55 -0000 1.8 +@@ -61,10 +61,7 @@ + | BlackListedHost -> gettext M.black_listed, Some !!O.color_not_connected + + let string_color_of_client friend_tab c = +- match c.client_files with +- Some _ when friend_tab -> +- gettext M.o_col_files_listed, Some !!O.color_downloading +- | _ -> string_color_of_state c.client_state ++ string_color_of_state c.client_state + + let shorten maxlen s = + let len = String.length s in +@@ -256,14 +253,7 @@ + Gui_com.send (GuiProto.FindFriend s) + + method on_select c = +- match c.client_files with +- None -> +-(* lprintf "No file for friend %d" c.client_num; lprint_newline (); *) + Gui_com.send (GuiProto.GetClient_files c.client_num) +- | Some tree -> +-(* lprintf "%d files for friend %d" (List.length l) c.client_num; +- lprint_newline (); *) +- box_files#update_tree (Some tree) + + method on_deselect f = + box_files#update_tree None +@@ -284,8 +274,6 @@ + method h_update_friend f_new = + try + let (row, f) = self#find_client f_new.client_num in +- if f_new.client_files <> None then +- f.client_files <- f_new.client_files; + f.client_state <- f_new.client_state; + f.client_type <- f_new.client_type; + f.client_rating <- f_new.client_rating; +@@ -426,8 +414,6 @@ + self#remove_item row c + end else + let _ = () in +- if c_new.client_files <> None then +- c.client_files <- c_new.client_files; + c.client_state <- c_new.client_state; + c.client_rating <- c_new.client_rating; + c.client_name <- c_new.client_name; +Index: src/gtk/gui/gui_main.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/gtk/gui/gui_main.ml,v +retrieving revision 1.14 +retrieving revision 1.15 +diff -u -r1.14 -r1.15 +--- src/gtk/gui/gui_main.ml 27 Jun 2006 10:38:35 -0000 1.14 ++++ src/gtk/gui/gui_main.ml 8 Jan 2007 14:07:55 -0000 1.15 +@@ -127,7 +127,6 @@ + if is_in_locations then + gui#tab_downloads#h_update_location c; + +- if c.client_files <> None then cc.client_files <- c.client_files; + cc.client_state <- c.client_state; + + if c.client_state = RemovedHost then begin +@@ -420,13 +419,11 @@ + try + let c = Hashtbl.find G.locations num in + try +- let tree = match c.client_files with +- None -> { file_tree_list = []; file_tree_name = "" } +- | Some tree -> { tree with file_tree_list = tree.file_tree_list } +- in +- ++ let tree = { file_tree_list = []; file_tree_name = "" } in + add_file tree dirname file; ++(* + ignore (canon_client gui { c with client_files = Some tree }) ++*) + + with _ -> + (* lprintf "File already there"; lprint_newline (); *) +@@ -519,6 +516,7 @@ + + | Search s -> () + | Version _ -> () ++ | Stats (_, _) -> () + + with e -> + lprintf "Exception %s in reader\n" (Printexc2.to_string e) Index: src/gtk/newgui/gui_downloads.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/gtk/newgui/gui_downloads.ml,v @@ -4834,11 +7156,30 @@ Index: src/gtk/newgui/gui_friends.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/gtk/newgui/gui_friends.ml,v retrieving revision 1.20 -retrieving revision 1.21 -diff -u -r1.20 -r1.21 +retrieving revision 1.22 +diff -u -r1.20 -r1.22 --- src/gtk/newgui/gui_friends.ml 28 Nov 2006 12:58:11 -0000 1.20 -+++ src/gtk/newgui/gui_friends.ml 2 Dec 2006 12:35:46 -0000 1.21 -@@ -435,8 +435,10 @@ ++++ src/gtk/newgui/gui_friends.ml 8 Jan 2007 14:07:55 -0000 1.22 +@@ -89,9 +89,7 @@ + | BlackListedHost -> O.gdk_pix M.o_xpm_blacklistedhost + + let client_pix c = +- match c.client_files with +- Some l -> O.gdk_pix M.o_xpm_files_listed +- | _ -> state_pix c.client_state ++ state_pix c.client_state + + + let type_pix t = +@@ -427,7 +425,6 @@ + client_type = c.gclient_type; + client_tags = c.gclient_tags; + client_name = c.gclient_name; +- client_files = c.gclient_files; + client_rating = c.gclient_rating; + client_chat_port = 0; + client_connect_time = c.gclient_connect_time; +@@ -435,10 +432,13 @@ client_os = None; client_release = c.gclient_release; client_emulemod = c.gclient_emulemod; @@ -4850,8 +7191,18 @@ diff -u -r1.20 -r1.21 + client_session_uploaded = 0L; client_upload = c.gclient_upload; client_sui_verified = None; ++ client_file_queue = []; (* client_sock_addr = c.gclient_sock_addr;*) -@@ -457,8 +459,8 @@ + } + +@@ -451,14 +451,14 @@ + gclient_type = c.client_type; + gclient_tags = c.client_tags; + gclient_name = c.client_name; +- gclient_files = c.client_files; ++ gclient_files = None; + gclient_rating = c.client_rating; + gclient_connect_time = (BasicSocket.last_time () - c.client_connect_time); gclient_software = c.client_software; gclient_release = c.client_release; gclient_emulemod = c.client_emulemod; @@ -4862,7 +7213,7 @@ diff -u -r1.20 -r1.21 gclient_upload = c.client_upload; gclient_sock_addr = string_of_kind c.client_kind; gclient_net_pixmap = -@@ -494,8 +496,8 @@ +@@ -494,8 +494,8 @@ f.gclient_software <- f_new.client_software; f.gclient_release <- f_new.client_release; f.gclient_emulemod <- f_new.client_emulemod; @@ -4873,7 +7224,15 @@ diff -u -r1.20 -r1.21 f.gclient_upload <- f_new.client_upload; f.gclient_sock_addr <- string_of_kind f_new.client_kind; if box_friends_is_visible then self#update_row f row -@@ -643,8 +645,10 @@ +@@ -635,7 +635,6 @@ + client_type = c.gclient_type; + client_tags = c.gclient_tags; + client_name = c.gclient_name; +- client_files = c.gclient_files; + client_rating = c.gclient_rating; + client_chat_port = 0; + client_connect_time = c.gclient_connect_time; +@@ -643,10 +642,13 @@ client_os = None; client_release = c.gclient_release; client_emulemod = c.gclient_emulemod; @@ -4885,8 +7244,18 @@ diff -u -r1.20 -r1.21 + client_session_uploaded = 0L; client_upload = c.gclient_upload; client_sui_verified = None; ++ client_file_queue = []; (* client_sock_addr = string_of_kind c.gclient_kind; *) -@@ -665,8 +669,8 @@ + } + +@@ -659,14 +661,14 @@ + gclient_type = c.client_type; + gclient_tags = c.client_tags; + gclient_name = c.client_name; +- gclient_files = c.client_files; ++ gclient_files = None; + gclient_rating = c.client_rating; + gclient_connect_time = (BasicSocket.last_time () - c.client_connect_time); gclient_software = c.client_software; gclient_release = c.client_release; gclient_emulemod = c.client_emulemod; @@ -4897,7 +7266,7 @@ diff -u -r1.20 -r1.21 gclient_upload = c.client_upload; gclient_sock_addr = string_of_kind c.client_kind; gclient_net_pixmap = -@@ -711,9 +715,9 @@ +@@ -711,9 +713,9 @@ c.gclient_kind <- c_new.client_kind; c.gclient_tags <- c_new.client_tags; c.gclient_software <- c_new.client_software; @@ -4935,24 +7304,45 @@ diff -u -r1.10 -r1.11 | _ -> () ) tags; !value +Index: src/gtk2/gui/guiMain.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/gtk2/gui/guiMain.ml,v +retrieving revision 1.9 +retrieving revision 1.10 +diff -u -r1.9 -r1.10 +--- src/gtk2/gui/guiMain.ml 29 Jun 2006 15:56:44 -0000 1.9 ++++ src/gtk2/gui/guiMain.ml 8 Jan 2007 14:07:55 -0000 1.10 +@@ -456,6 +456,7 @@ + | GiftServerStats _ -> assert false + | Search s -> () + | Version v -> () ++ | Stats (_, _) -> () + + with e -> + Printf2.lprintf "Exception %s in reader\n" (Printexc2.to_string e) Index: src/gtk2/gui/guiMisc.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/gtk2/gui/guiMisc.ml,v retrieving revision 1.20 -retrieving revision 1.22 -diff -u -r1.20 -r1.22 +retrieving revision 1.24 +diff -u -r1.20 -r1.24 --- src/gtk2/gui/guiMisc.ml 28 Nov 2006 12:58:11 -0000 1.20 -+++ src/gtk2/gui/guiMisc.ml 3 Dec 2006 20:49:42 -0000 1.22 -@@ -1055,7 +1055,7 @@ ++++ src/gtk2/gui/guiMisc.ml 8 Jan 2007 14:07:55 -0000 1.24 +@@ -1050,11 +1050,13 @@ + | Field_Completesources -> "completesources" + | Field_Filename -> "filename" + | Field_Size -> "size" ++ | Field_Size_Hi -> "size_hi" + | Field_Uid -> "uid" + | Field_Medialength -> "length" | Field_Mediacodec -> "codec" | Field_Lastseencomplete -> "lastseencompl" | Field_Filerating -> "rating" -- | Field_UNKNOWN s -> U.simple_utf8_of s + | Field_KNOWN s -> U.simple_utf8_of s + | Field_UNKNOWN s -> U.simple_utf8_of s let tags_to_string tags = - let s = ref "" in -@@ -1276,8 +1276,8 @@ +@@ -1276,8 +1278,8 @@ source_connect_time = BasicSocket.last_time () - c.client_connect_time; source_last_seen = BasicSocket.current_time (); source_software = concat_strings c.client_software (concat_strings c.client_emulemod c.client_release); @@ -5014,11 +7404,41 @@ Index: src/networks/bittorrent/bTInteractive.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v retrieving revision 1.123 -retrieving revision 1.125 -diff -u -r1.123 -r1.125 +retrieving revision 1.127 +diff -u -r1.123 -r1.127 --- src/networks/bittorrent/bTInteractive.ml 12 Nov 2006 14:17:45 -0000 1.123 -+++ src/networks/bittorrent/bTInteractive.ml 3 Dec 2006 20:57:56 -0000 1.125 -@@ -406,8 +406,10 @@ ++++ src/networks/bittorrent/bTInteractive.ml 4 Feb 2007 17:22:18 -0000 1.127 +@@ -171,18 +171,21 @@ + Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); + let tracker_header_printed = ref false in + List.iter (fun tracker -> +- let tracker_text, tracker_error = +- (match tracker.tracker_status with +- Disabled s | Disabled_mld s | Disabled_failure s -> +- Printf.sprintf "disabled: %s" tracker.tracker_url, s +- | _ -> tracker.tracker_url, "") ++ let tracker_text = ++ match tracker.tracker_status with ++ | Disabled s | Disabled_mld s | Disabled_failure s -> ++ Printf.sprintf "\\<font color=\\\"red\\\"\\>disabled: %s\\<br\\>\\--error: %s\\</font\\>" tracker.tracker_url s ++ | _ -> ++ Printf.sprintf "enabled: %s" tracker.tracker_url ++ + in + html_mods_td buf [ + (if not !tracker_header_printed then +- ("Tracker(s) (mouseover for errors)", "sr br", "Tracker(s)") ++ ("Tracker(s)", "sr br", "Tracker(s)") + else +- ("", "sr br", "")); +- (tracker_error, "sr", tracker_text)]; ++ ("", "sr br", "") ++ ); ++ (tracker.tracker_url, "sr", tracker_text)]; + Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); + tracker_header_printed := true; + ) file.file_trackers; +@@ -406,8 +409,10 @@ ( "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 []) @ [ @@ -5031,7 +7451,7 @@ diff -u -r1.123 -r1.125 ( "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" ) ; -@@ -458,8 +460,10 @@ +@@ -458,8 +463,10 @@ ("", "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 []) @ [ @@ -5044,7 +7464,7 @@ diff -u -r1.123 -r1.125 ("", "sr", (btos c.client_interested)); ("", "sr", (btos c.client_choked)); ("", "sr br ar", (Int64.to_string c.client_allowed_to_write)); -@@ -880,8 +884,10 @@ +@@ -880,8 +887,10 @@ 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; @@ -5057,7 +7477,7 @@ diff -u -r1.123 -r1.125 P.client_upload = Some (c.client_file.file_name); P.client_connect_time = c.client_connect_time; -@@ -906,11 +912,11 @@ +@@ -906,11 +915,11 @@ let cc = as_client c in client_print cc o; Printf.bprintf buf (_b "\n%18sDown : %-10s Uploaded: %-10s Ratio: %s%1.1f (%s)\n") "" @@ -5074,7 +7494,7 @@ diff -u -r1.123 -r1.125 else 1.) ("BT"); (Printf.bprintf buf (_b "%18sFile : %s\n") "" info.GuiTypes.file_name) -@@ -948,8 +954,10 @@ +@@ -948,8 +957,10 @@ ("", "sr", "N"); ("", "sr", (Ip.to_string (fst c.client_host))); ] @ (if !Geoip.active then [(cn, "sr", cc)] else []) @ [ @@ -5087,7 +7507,16 @@ diff -u -r1.123 -r1.125 ("", "sr", info.GuiTypes.file_name); ]); true -@@ -1263,6 +1271,9 @@ +@@ -1047,7 +1058,7 @@ + ) !current_files; + _s "done" + end else +- begin print_command_result o o.conn_buf "You are not allowed to use seeded_torrents"; ++ begin print_command_result o "You are not allowed to use seeded_torrents"; + "" end + ), _s ":\t\t\tprint all seeded .torrent files on this server"; + +@@ -1263,6 +1274,9 @@ CommonNetwork.register_commands commands; @@ -5097,6 +7526,38 @@ diff -u -r1.123 -r1.125 shared_ops.op_shared_unshare <- (fun file -> (if !verbose_share then lprintf_file_nl (as_file file) "unshare file"); BTGlobals.unshare_file file); +Index: src/networks/bittorrent/bTOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTOptions.ml,v +retrieving revision 1.30 +retrieving revision 1.31 +diff -u -r1.30 -r1.31 +--- src/networks/bittorrent/bTOptions.ml 21 Aug 2006 18:30:15 -0000 1.30 ++++ src/networks/bittorrent/bTOptions.ml 15 Jan 2007 18:26:27 -0000 1.31 +@@ -26,6 +26,7 @@ + let bittorrent_section = file_section bittorrent_ini ["Bittorrent"] "Bittorrent options" + + let client_port = define_option bittorrent_section ["client_port"] ++ ~restart: true + "The port to bind the client to" + int_option 6882 + +@@ -99,6 +100,7 @@ + int_option (-1) + + let import_new_torrents_interval = define_option bittorrent_section ["import_new_torrents_interval"] ++ ~restart: true + "Interval in seconds 'torrents/incoming' is scanned for new torrent files to be downloaded, + 0 to deactivate, changes require restart" + float_option 60. +@@ -130,6 +132,7 @@ + string_option "default" + + let options_version = define_option bittorrent_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + Index: src/networks/bittorrent/bTStats.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTStats.ml,v @@ -5125,6 +7586,22 @@ diff -u -r1.8 -r1.9 bt_upload_counter := !bt_upload_counter ++ v; global_count_upload network v +Index: src/networks/bittorrent/bTTracker.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTTracker.ml,v +retrieving revision 1.25 +retrieving revision 1.26 +diff -u -r1.25 -r1.26 +--- src/networks/bittorrent/bTTracker.ml 27 Jul 2006 21:45:05 -0000 1.25 ++++ src/networks/bittorrent/bTTracker.ml 15 Jan 2007 18:26:27 -0000 1.26 +@@ -96,6 +96,7 @@ + let ntracked_files = ref 0 + + let tracker_port = define_option bittorrent_section ["tracker_port"] ++ ~restart: true + "The port to bind the tracker to" + int_option 6881 + Index: src/networks/bittorrent/bTTypes.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTTypes.ml,v @@ -5171,14 +7648,38 @@ diff -u -r1.28 -r1.29 else list ); +Index: src/networks/direct_connect/dcOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/direct_connect/dcOptions.ml,v +retrieving revision 1.7 +retrieving revision 1.8 +diff -u -r1.7 -r1.8 +--- src/networks/direct_connect/dcOptions.ml 5 Nov 2005 16:23:40 -0000 1.7 ++++ src/networks/direct_connect/dcOptions.ml 15 Jan 2007 18:26:27 -0000 1.8 +@@ -57,6 +57,7 @@ + + + let dc_port = define_option directconnect_section ["client_port"] ++ ~restart: true + "The port to bind the client to" + int_option 4444 + +@@ -88,6 +89,7 @@ + string_option "Pk=mldc" + + let options_version = define_option directconnect_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + Index: src/networks/donkey/donkeyClient.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml,v retrieving revision 1.110 -retrieving revision 1.114 -diff -u -r1.110 -r1.114 +retrieving revision 1.121 +diff -u -r1.110 -r1.121 --- src/networks/donkey/donkeyClient.ml 26 Nov 2006 16:36:29 -0000 1.110 -+++ src/networks/donkey/donkeyClient.ml 3 Dec 2006 20:49:42 -0000 1.114 ++++ src/networks/donkey/donkeyClient.ml 15 Jan 2007 21:32:56 -0000 1.121 @@ -68,40 +68,43 @@ (*************************************************************************) (* adding a source to the source-management *) @@ -5256,7 +7757,16 @@ diff -u -r1.110 -r1.114 let is_banned c sock = c.client_banned <- Hashtbl.mem banned_ips (fst (peer_addr sock)) -@@ -245,18 +248,22 @@ +@@ -112,7 +115,7 @@ + match cb with + Brand_lmule | Brand_newemule | Brand_cdonkey | + Brand_emuleplus | Brand_hydranode | Brand_mldonkey3 | +- Brand_shareaza | Brand_amule | Brand_lphant | Brand_verycd -> true ++ Brand_shareaza | Brand_amule | Brand_lphant | Brand_verycd | Brand_imp -> true + | _ -> false + + let ban_client c sock msg = +@@ -245,20 +248,7 @@ c.client_source.DonkeySources.source_sock <- NoConnection | Connection sock -> (try @@ -5269,27 +7779,105 @@ diff -u -r1.110 -r1.114 - 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 "") -+ let log_print cc = lprintf_nl "Client[%d] %s disconnected, connected %s%s%s" -+ (client_num c) (full_client_identifier c) -+ (Date.time_to_string (last_time () - c.client_connect_time) "verbose") -+ (if c.client_total_uploaded > 0L then -+ Printf.sprintf ", send %s (%s)%s" -+ (size_of_int64 c.client_session_uploaded) -+ (size_of_int64 c.client_total_uploaded) -+ (match client_upload (as_client c) with | None -> "" -+ | Some f -> " of " ^ (CommonFile.file_best_name f)) else "") -+ (if c.client_total_downloaded > 0L then -+ Printf.sprintf ", rec %s (%s)" -+ (size_of_int64 c.client_session_downloaded) -+ (size_of_int64 c.client_total_downloaded) else "") - in - if c.client_debug || +- in +- if c.client_debug || - (!verbose && (c.client_uploaded > 0L || c.client_downloaded > 0L)) then -+ (!verbose && (c.client_session_uploaded > 0L || c.client_session_downloaded > 0L)) then - log_print c; - +- log_print c; +- ++ DonkeyOneFile.remove_client_slot c; c.client_comp <- None; -@@ -599,7 +606,7 @@ + (try if c.client_checked then count_seen c with _ -> ()); + (try if !!log_clients_on_console && c.client_name <> "" then +@@ -266,43 +256,34 @@ + c.client_connect_time <- 0; + (try Hashtbl.remove connected_clients c.client_md4 with _ -> ()); + (try CommonUploads.remove_pending_slot (as_client c) with _ -> ()); +- set_client_has_a_slot (as_client c) NoSlot; +-(* connection_failed c.client_connection_control; *) + (try TcpBufferedSocket.close sock reason with _ -> ()); + + (* Remove the Connected and NoLimit tags *) + set_client_type c (client_type c + land (lnot (client_initialized_tag lor client_nolimit_tag))); +-(* c.client_chunks <- [||];*) + c.client_source.DonkeySources.source_sock <- NoConnection; + save_join_queue c; + c.client_slot <- SlotNotAsked; +- let files = c.client_file_queue in + +- (try DonkeyOneFile.clean_current_download c with _ -> ()); ++(* clean_client_zones: clean all structures related to downloads when ++ a client disconnects *) ++ (try ++ match c.client_download with ++ | None -> () ++ | Some (file, up) -> ++ CommonSwarming.unregister_uploader up; ++ c.client_download <- None ++ with _ -> ()); + + List.iter (fun (file, chunks, up) -> + try CommonSwarming.unregister_uploader up with _ -> () +- ) +- files; ++ ) c.client_file_queue; ++ + c.client_file_queue <- []; +- if c.client_upload != None then CommonUploads.refill_upload_slots (); ++ c.client_session_downloaded <- 0L; + + with e -> lprintf_nl "Exception %s in disconnect_client" + (Printexc2.to_string e)); +-(* lprintf "Client %d to source:" (client_num c); +- List.iter (fun r -> +- lprint_char ( +- match r.request_result with +- | File_chunk -> 'C' +- | File_upload -> 'U' +- | File_not_found -> '-' +- | File_found -> '+' +- | File_possible -> '?' +- | File_expected -> '!' +- | File_new_source -> 'n' +- )) c.client_files; +- lprintf "\n"; *) + set_client_disconnected c reason; + DonkeySources.source_disconnected c.client_source + +@@ -441,16 +422,24 @@ + + + let new_chunk up begin_pos end_pos = +- if begin_pos <> end_pos then +- let pair = (begin_pos, end_pos) in +- (match up.up_chunks with +- [] -> ++ let req_size = end_pos -- begin_pos in ++ let req_location = (begin_pos ++ end_pos) // (2L ** block_size) in ++ if !verbose_upload then ++ lprintf_nl "new block: (%Ld,%Ld) size %Ld chunk #%Ld" begin_pos end_pos req_size req_location; ++ if (req_size < Int64.zero) || (req_size > zone_size) || ((up.up_current <> req_location) && (req_size <> Int64.zero)) then ++ up.up_finish <- true; ++ if ((not up.up_finish) || (not !!upload_complete_chunks)) && (req_size > Int64.zero) && (req_size <= zone_size) then ++ let chunk = (begin_pos, end_pos) in ++ (* the zone requested is already "in the pipe" *) ++ if not (List.mem chunk up.up_flying_chunks) then ++ match up.up_chunks with ++ | [] -> + up.up_pos <- begin_pos; + up.up_end_chunk <- end_pos; +- up.up_chunks <- [pair]; +- | chunks -> +- if not (List.mem pair chunks) then +- up.up_chunks <- chunks @ [pair]) ++ up.up_chunks <- [chunk]; ++ | up_chunks -> ++ if not (List.mem chunk up_chunks) then ++ up.up_chunks <- up_chunks @ [chunk] + + let identify_client_brand c = + if c.client_brand = Brand_unknown then +@@ -599,7 +588,7 @@ List.iter (fun tag -> let s = to_lowercase (string_of_tag_value tag.tag_value) in match tag.tag_name with @@ -5298,7 +7886,15 @@ diff -u -r1.110 -r1.114 begin let rec iter i len = if i < len then -@@ -661,33 +668,40 @@ +@@ -647,6 +636,7 @@ + | 6 -> Brand_hydranode + | 10 -> Brand_mldonkey3 + | 20 -> Brand_lphant ++ | 60 -> Brand_imp + | 240 -> Brand_verycd + | _ -> Brand_unknown + +@@ -661,33 +651,42 @@ iter 0 (Array.length mod_array) let update_client_from_tags c tags = @@ -5317,6 +7913,7 @@ diff -u -r1.110 -r1.114 ) - | Field_UNKNOWN "emule_miscoptions1" -> + | Field_KNOWN "emule_miscoptions1" -> ++ c.client_emule_proto.received_miscoptions1 <- true; for_int64_tag tag (fun i -> - DonkeyProtoClient.update_emule_proto_from_miscoptions1 - c.client_emule_proto i @@ -5329,6 +7926,7 @@ diff -u -r1.110 -r1.114 ) - | Field_UNKNOWN "emule_miscoptions2" -> + | Field_KNOWN "emule_miscoptions2" -> ++ c.client_emule_proto.received_miscoptions2 <- true; for_int64_tag tag (fun i -> - DonkeyProtoClient.update_emule_proto_from_miscoptions2 - c.client_emule_proto i @@ -5351,7 +7949,7 @@ diff -u -r1.110 -r1.114 for_int_tag tag (fun i -> c.client_emule_proto.emule_version <- i; let compatibleclient = (i lsr 24) in -@@ -697,60 +711,62 @@ +@@ -697,60 +696,62 @@ if c.client_brand = Brand_unknown then lprintf_nl "[emule_version] Brand_unknown %s" (full_client_identifier c); ) @@ -5433,7 +8031,7 @@ diff -u -r1.110 -r1.114 ) tags let fight_disguised_mods c = -@@ -771,7 +787,7 @@ +@@ -771,7 +772,7 @@ emule_info with DonkeyProtoClient.EmuleClientInfo.protversion = 255; DonkeyProtoClient.EmuleClientInfo.tags = [ @@ -5442,7 +8040,16 @@ diff -u -r1.110 -r1.114 ]} in client_send c (DonkeyProtoClient.EmuleClientInfoReq emule_osinfo); c.client_osinfo_sent <- true -@@ -1160,7 +1176,7 @@ +@@ -1128,7 +1129,7 @@ + let module M = DonkeyProtoClient in + + if !verbose_msg_clients || c.client_debug then begin +- lprintf_nl "Message from %s" (string_of_client c); ++ lprintf_nl "Message from %s" (full_client_identifier c); + M.print t; + end; + +@@ -1160,7 +1161,7 @@ List.iter (fun tag -> match tag with @@ -5451,12 +8058,93 @@ diff -u -r1.110 -r1.114 set_client_name c s t.CR.md4 | _ -> () ) c.client_tags; -@@ -2018,13 +2034,13 @@ +@@ -1401,7 +1402,7 @@ + | Some f -> CommonFile.file_best_name f); + (* end *) + +- | M.CloseSlotReq _ -> ++ | M.OutOfPartsReq _ -> + set_client_state c (Connected 0); begin + match c.client_download with +@@ -1411,7 +1412,7 @@ + lprintf_nl "Slot closed during download"; + CommonSwarming.clear_uploader_ranges up + end; +-(* DonkeyOneFile.clean_current_download c; *) ++ c.client_session_downloaded <- 0L; + c.client_slot <- SlotNotAsked; + (* OK, the slot is closed, but what should we do now ????? *) + begin +@@ -1419,7 +1420,7 @@ + [] -> () + | _ -> + if !verbose_download then +- lprintf_nl "CloseSlotReq"; ++ lprintf_nl "OutOfPartsReq"; + DonkeyOneFile.request_slot c; + set_rtimeout sock !!queued_timeout; + end +@@ -1560,8 +1561,7 @@ + (* if file.file_exists then verify_chunks file *) + end + +- +- | M.EmuleCompressedPart (md4, statpos, newsize, bloc) -> ++ | M.EmuleCompressedPart t -> + + set_lifetime sock active_lifetime; + if !!reliable_sources && +@@ -1572,12 +1572,13 @@ + raise Not_found + end; + ++ let module Q = M.EmuleCompressedPart in + let comp = match c.client_comp with + None -> + let comp = { +- comp_md4 = md4; +- comp_pos = statpos; +- comp_total = Int64.to_int newsize; ++ comp_md4 = t.Q.md4; ++ comp_pos = t.Q.statpos; ++ comp_total = Int64.to_int t.Q.newsize; + comp_len = 0; + comp_blocs = []; + } in +@@ -1585,8 +1586,8 @@ + comp + | Some comp -> comp + in +- comp.comp_blocs <- bloc :: comp.comp_blocs; +- comp.comp_len <- comp.comp_len + String.length bloc; ++ comp.comp_blocs <- t.Q.bloc :: comp.comp_blocs; ++ comp.comp_len <- comp.comp_len + String.length t.Q.bloc; + + (* lprintf "Comp bloc: %d/%d\n" comp.comp_len comp.comp_total; *) + if comp.comp_len = comp.comp_total then begin +@@ -2008,44 +2009,65 @@ + | M.QueryBlocReq t when !CommonUploads.has_upload = 0 && + client_has_a_slot (as_client c) -> + +- if !verbose_upload then +- lprintf_nl "donkeyClient: uploader %s ask for block" (full_client_identifier c); +- + let module Q = M.QueryBloc in +- let file = find_file t.Q.md4 in ++ let file = find_file t.Q.md4 in ++ ++ if !verbose_upload then lprintf_nl "donkeyClient: uploader %s asks for %s" ++ (full_client_identifier c) (file_best_name file); ++ + let prio = (file_priority file) in + let client_upload_lifetime = ref ((max 0 !!upload_lifetime) * 60) in +- begin - if !!dynamic_upload_lifetime +- if !!dynamic_upload_lifetime - && c.client_uploaded > c.client_downloaded - && c.client_uploaded > Int64.of_int !!dynamic_upload_threshold ** zone_size ++ if !!dynamic_upload_lifetime && not !!upload_complete_chunks + && c.client_session_uploaded > c.client_session_downloaded + && c.client_session_uploaded > Int64.of_int !!dynamic_upload_threshold ** zone_size then @@ -5464,11 +8152,110 @@ diff -u -r1.110 -r1.114 Int64.to_int (Int64.of_int !client_upload_lifetime - ** c.client_downloaded // c.client_uploaded); +- if last_time() > c.client_connect_time + +- !client_upload_lifetime + 5 * prio then +- begin + ** c.client_session_downloaded // c.client_session_uploaded); - if last_time() > c.client_connect_time + - !client_upload_lifetime + 5 * prio then - begin -@@ -2193,7 +2209,7 @@ + +-(* And what happens if we were downloading from this client also ? *) +- +- disconnect_client c (Closed_for_error "Upload lifetime expired"); ++ let client_received_enough c = ++ if !!upload_full_chunks && not !!upload_complete_chunks then ++ c.client_session_uploaded > (block_size ++ 20L ** 1024L) ++ else ++ last_time() > c.client_connect_time + !client_upload_lifetime + 5 * prio ++ in ++ ++ begin ++ if client_received_enough c then ++ if Intmap.length !CommonUploads.pending_slots_map = 0 then ++ begin ++ if !verbose_upload then lprintf_nl ++ "donkeyClient: not closing upload slot of %s (%s), pending slots empty, sending next block..." ++ (full_client_identifier c) (file_best_name file) ++ end ++ else begin ++ DonkeyOneFile.remove_client_slot c; + raise Not_found + end; +- ++ + set_lifetime sock active_lifetime; + set_rtimeout sock !!upload_timeout; +- ++ + let up, waiting = match c.client_upload with +- Some ({ up_file = f } as up) when f == file -> up, up.up_waiting ++ | Some ({ up_file = f } as up) when f == file -> ++ (* zones are received in the order they're sent, so we ++ know that the oldest of the zones "in fly" must have ++ been received when this QueryBlockReq was sent *) ++ (match up.up_flying_chunks with ++ | [] -> () ++ | _ :: q -> up.up_flying_chunks <- q); ++ up, up.up_waiting + | Some old_up -> + { + up_file = file; + up_pos = Int64.zero; + up_end_chunk = Int64.zero; + up_chunks = []; ++ up_flying_chunks = []; ++ up_current = Int64.zero; ++ up_finish = true; + up_waiting = old_up.up_waiting; + }, old_up.up_waiting + | _ -> +@@ -2054,18 +2076,31 @@ + up_pos = Int64.zero; + up_end_chunk = Int64.zero; + up_chunks = []; ++ up_flying_chunks = []; ++ up_current = ((t.Q.start_pos1 ++ t.Q.end_pos1) // (2L ** block_size)); ++ up_finish = false; + up_waiting = false; + }, false + in + new_chunk up t.Q.start_pos1 t.Q.end_pos1; + new_chunk up t.Q.start_pos2 t.Q.end_pos2; + new_chunk up t.Q.start_pos3 t.Q.end_pos3; ++ (match up.up_chunks with ++ [] -> ++(* it should never happen here, that a client with up.up_finish = false ++ has an empty block queue *) ++ if up.up_finish && !!upload_complete_chunks then ++ begin ++ DonkeyOneFile.remove_client_slot c; ++ raise Not_found ++ end; ++ | chunks -> + c.client_upload <- Some up; + set_client_upload (as_client c) (as_file file); + if not waiting && !CommonUploads.has_upload = 0 then begin + CommonUploads.ready_for_upload (as_client c); + up.up_waiting <- true +- end ++ end) + end; + if !verbose_upload then lprintf_nl "QueryBloc treated" + +@@ -2141,12 +2176,12 @@ + let init_client sock c = + set_handler sock WRITE_DONE (fun s -> + match c.client_upload with +- None -> () +- | Some up -> ++ | Some ({ up_chunks = _ :: _ } as up) -> + if not up.up_waiting && !CommonUploads.has_upload = 0 then begin + up.up_waiting <- true; + CommonUploads.ready_for_upload (as_client c) + end ++ | _ -> () + ); + (* + set_handler sock (BASIC_EVENT RTIMEOUT) (fun s -> +@@ -2193,7 +2228,7 @@ let name = ref "" in List.iter (fun tag -> match tag with @@ -5477,15 +8264,305 @@ diff -u -r1.110 -r1.114 | _ -> () ) t.CR.tags; +Index: src/networks/donkey/donkeyComplexOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyComplexOptions.ml,v +retrieving revision 1.61 +retrieving revision 1.62 +diff -u -r1.61 -r1.62 +--- src/networks/donkey/donkeyComplexOptions.ml 28 Nov 2006 11:56:12 -0000 1.61 ++++ src/networks/donkey/donkeyComplexOptions.ml 6 Jan 2007 18:15:17 -0000 1.62 +@@ -559,6 +559,8 @@ + r.result_size <- v; + | { tag_name = Field_Size; tag_value = (Uint16 v| Uint8 v) } -> + r.result_size <- Int64.of_int v; ++ | { tag_name = Field_Size_Hi; tag_value = Uint8 v } -> ++ r.result_size <- Int64.logor r.result_size (Int64.shift_left (Int64.of_int v) 32); + | { tag_name = Field_Format; tag_value = String s } -> + r.result_tags <- tag :: r.result_tags; + r.result_format <- s +Index: src/networks/donkey/donkeyFiles.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyFiles.ml,v +retrieving revision 1.22 +retrieving revision 1.27 +diff -u -r1.22 -r1.27 +--- src/networks/donkey/donkeyFiles.ml 21 Nov 2006 22:34:33 -0000 1.22 ++++ src/networks/donkey/donkeyFiles.ml 15 Jan 2007 18:28:03 -0000 1.27 +@@ -61,6 +61,51 @@ + where nseconds = Fifo.length upload_clients + + *) ++exception Cache_table_hit of string * string ++type cache_entry = { ++ md4 : Md4.t; ++ begin_offset : int64; ++ end_offset : int64; ++ cached_part : string; ++ comp_part : string ++ } ++let cache_table_index = ref 0 ++let cache_table_size = !!upload_compression_table_size ++let ( cache_table : cache_entry Weak.t ) = Weak.create cache_table_size ++let cached_load file begin_offset end_offset compress= ++ try ++ for i = 0 to cache_table_size-1 do ++ match Weak.get cache_table i with ++ Some ({md4=md4;begin_offset=bo;end_offset=eo;cached_part=cached_file;comp_part=cached_comp}) when (md4 = file.file_md4) && (bo=begin_offset) && (eo=end_offset) -> ++ if !verbose_upload then ++ lprintf_nl "Cache Hit for %s (%Ld,%Ld)" (file_best_name file) begin_offset end_offset; ++ if (compress && (String.length cached_comp > 0)) || not compress then raise (Cache_table_hit(cached_file,cached_comp)) ++ | _ -> () ++ done; ++ let entry_length = Int64.to_int(end_offset -- begin_offset) in ++ let cached_file = String.create entry_length in ++ Unix32.read (file_fd file) begin_offset cached_file 0 entry_length; ++ let cached_comp = if compress then ++ Zlib.compress_string ~level:!!upload_compression_level cached_file ++ else ++ "" ++ in ++ cache_table_index := (!cache_table_index + 1) mod cache_table_size; ++ let (entry : cache_entry)={ ++ md4=file.file_md4; ++ begin_offset=begin_offset; ++ end_offset=end_offset; ++ cached_part=cached_file; ++ comp_part=cached_comp} in ++ Weak.set cache_table !cache_table_index (Some entry); ++ if !verbose_upload then ++ lprintf_nl "Cache Miss for %s (%Ld,%Ld) orig.len %d comp.len %d" (file_best_name file) begin_offset end_offset (String.length cached_file) (String.length cached_comp); ++ Some (cached_file,cached_comp) ++ with ++ | Cache_table_hit (cached_file,cached_comp) -> Some (cached_file,cached_comp) ++ | End_of_file -> if !verbose then lprintf_nl ++ "End_of_file in cached_load file %s size %Ld begin %Ld end %Ld" (file_best_name file) (file_size file) begin_offset end_offset; None ++ + + module NewUpload = struct + +@@ -74,14 +119,12 @@ + M.CloseSlotReq Q.t) + *) + +- let rec send_small_block c sock file begin_pos len_int = +-(* lprintf "send_small_block %d\n" len_int; *) +-(* let len_int = Int32.to_int len in *) ++ let rec send_small_block_plain c sock file begin_offset cfile pos len_int sixtyfour = + try + if !verbose_upload then +- lprintf_nl "Sending %s to %s, begin %Ld len %d" ++ lprintf_nl "Sending plain %s to %s, begin_offset %Ld pos %d len %d" + (file_best_name file) (full_client_identifier c) +- (begin_pos) (len_int); ++ (begin_offset) (pos) (len_int); + + let msg = + ( +@@ -89,8 +132,9 @@ + let module B = M.Bloc in + M.BlocReq { + B.md4 = file.file_md4; +- B.start_pos = begin_pos; +- B.end_pos = begin_pos ++ (Int64.of_int len_int); ++ B.usesixtyfour = sixtyfour; ++ B.start_pos = begin_offset ++ (Int64.of_int pos); ++ B.end_pos = begin_offset ++ (Int64.of_int(pos + len_int)); + B.bloc_str = ""; + B.bloc_begin = 0; + B.bloc_len = 0; +@@ -101,7 +145,7 @@ + let upload_buffer = String.create (slen + len_int) in + String.blit s 0 upload_buffer 0 slen; + DonkeyProtoCom.new_string msg upload_buffer; +- Unix32.read (file_fd file) begin_pos upload_buffer slen len_int; ++ String.blit cfile pos upload_buffer slen len_int; + let uploaded = Int64.of_int len_int in + count_upload c uploaded; + CommonUploads.consume_bandwidth len_int; +@@ -114,36 +158,95 @@ + write_string sock upload_buffer; + check_end_upload c sock + with +- End_of_file -> lprintf_nl "Can not send file %s to %s, file removed?" ++ | e -> if !verbose then lprintf_nl ++ "Exception %s in send_small_block_plain" (Printexc2.to_string e) ++ ++ let rec send_small_block_compressed c sock file begin_offset ccomp pos len_int pay_len sixtyfour = ++ try ++ if !verbose_upload then ++ lprintf_nl "Sending compressed %s to %s, begin_offset %Ld pos %d len %d" + (file_best_name file) (full_client_identifier c) ++ (begin_offset) (pos) (len_int); ++ ++ let msg = ++ ( ++ let module M = DonkeyProtoClient in ++ let module B = M.EmuleCompressedPart in ++ M.EmuleCompressedPart { ++ B.md4 = file.file_md4; ++ B.usesixtyfour = sixtyfour; ++ B.statpos = begin_offset; ++ B.newsize = Int64.of_int pay_len; ++ B.bloc = ""; ++ } ++ ) in ++ let s = client_msg_to_string c.client_emule_proto msg in ++ let slen = String.length s in ++ let upload_buffer = String.create (slen + len_int) in ++ String.blit s 0 upload_buffer 0 slen; ++ DonkeyProtoCom.new_string msg upload_buffer; ++ String.blit ccomp pos upload_buffer slen len_int; ++ CommonUploads.consume_bandwidth len_int; ++ ++ write_string sock upload_buffer; ++ check_end_upload c sock ++ with + | e -> if !verbose then lprintf_nl +- "Exception %s in send_small_block" (Printexc2.to_string e) ++ "Exception %s in send_small_block_compressed" (Printexc2.to_string e) + + let rec send_client_block c sock per_client = +-(* lprintf "send_client_block\n"; *) ++ try + if per_client > 0 && CommonUploads.can_write_len sock max_msg_size then + match c.client_upload with +- | Some ({ up_chunks = _ :: chunks } as up) -> +- if up.up_file.file_shared = None then begin ++ | Some ({ up_chunks = (begin_offset,end_offset) :: chunks } as up) -> ++ if file_is_largefile up.up_file && c.client_emule_proto.emule_largefiles <> 1 then begin ++ DonkeyOneFile.remove_client_slot c; ++ lprintf_nl "File %s is too large for %s." (file_best_name up.up_file) (full_client_identifier c); ++ end else ++ if up.up_file.file_shared = None then + (* Is there a message to warn that a file is not shared anymore ? *) +- c.client_upload <- None; +- end else +- let max_len = up.up_end_chunk -- up.up_pos in +- let max_len = Int64.to_int max_len in +- let msg_block_size_int = min msg_block_size_int per_client in +- if max_len <= msg_block_size_int then ++ DonkeyOneFile.remove_client_slot c ++ else ++ let compress = !!upload_compression && (c.client_emule_proto.emule_compression <> 0) in ++ let cfile,ccomp = match cached_load up.up_file begin_offset end_offset compress with ++ Some (cached_file,cached_comp) -> cached_file,cached_comp ++ | _ -> "","" ++ in ++ let compressed = compress && ((String.length ccomp) + !!upload_compression_threshold < (String.length cfile)) in ++ let pay_len = if compressed then (String.length ccomp) else (String.length cfile) in ++ let pos = Int64.to_int (up.up_pos -- begin_offset) in ++ let max_len = pay_len - pos in ++ let allowed_msg_block_size_int = min msg_block_size_int per_client in ++ let sixtyfour = end_offset >= old_max_emule_file_size in ++ if max_len <= allowed_msg_block_size_int then + (* last block from chunk *) + begin ++ if compressed then ++ begin ++ send_small_block_compressed c sock up.up_file begin_offset ccomp pos max_len pay_len sixtyfour; ++ let uploaded = end_offset -- begin_offset in ++ count_upload c uploaded; ++ (match up.up_file.file_shared with None -> () ++ | Some impl -> ++ shared_must_update_downloaded (as_shared impl); ++ impl.impl_shared_uploaded <- ++ impl.impl_shared_uploaded ++ uploaded) ++ end ++ else ++ send_small_block_plain c sock up.up_file begin_offset cfile pos max_len sixtyfour ++ ; + if !verbose_upload then +- lprintf_nl "End of chunk (%d) %Ld %s" max_len up.up_end_chunk (file_best_name up.up_file); +- send_small_block c sock up.up_file up.up_pos max_len; ++ lprintf_nl "End of chunk %Ld %Ld %s" begin_offset end_offset (file_best_name up.up_file); ++ up.up_flying_chunks <- up.up_flying_chunks @ [(begin_offset,end_offset)]; + up.up_chunks <- chunks; + let per_client = per_client - max_len in + match chunks with +- [] -> ++ | [] -> + if !verbose_upload then +- lprintf_nl "NO CHUNKS"; +- c.client_upload <- None; ++ lprintf_nl "NO MORE CHUNKS"; ++ up.up_waiting <- false; ++ if up.up_finish && !!upload_complete_chunks then ++ DonkeyOneFile.remove_client_slot c; + | (begin_pos, end_pos) :: _ -> + up.up_pos <- begin_pos; + up.up_end_chunk <- end_pos; +@@ -151,14 +254,25 @@ + end + else + (* small block from chunk *) ++ if allowed_msg_block_size_int >= msg_block_size_int then ++ begin ++ if compressed then + begin +- send_small_block c sock up.up_file up.up_pos +- msg_block_size_int; ++ send_small_block_compressed c sock up.up_file begin_offset ccomp pos msg_block_size_int pay_len sixtyfour; ++ end ++ else ++ begin ++ send_small_block_plain c sock up.up_file begin_offset cfile pos msg_block_size_int sixtyfour; ++ end ++ ; + up.up_pos <- up.up_pos ++ (Int64.of_int msg_block_size_int); + let per_client = per_client-msg_block_size_int in + send_client_block c sock per_client + end + | _ -> () ++ with ++ | e -> if !verbose then lprintf_nl ++ "Exception %s in send_client_block" (Printexc2.to_string e) + + let upload_to_client c size = + (* lprintf "upload_to_client %d\n" size; *) +@@ -168,10 +282,10 @@ + let size = min max_msg_size size in + send_client_block c sock size; + (match c.client_upload with +- None -> () +- | Some up -> ++ | Some ({ up_chunks = _ :: _ }) -> + if !CommonUploads.has_upload = 0 then + CommonUploads.ready_for_upload (as_client c) ++ | _ -> () + ) + ) + let _ = Index: src/networks/donkey/donkeyGlobals.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyGlobals.ml,v retrieving revision 1.110 -retrieving revision 1.112 -diff -u -r1.110 -r1.112 +retrieving revision 1.115 +diff -u -r1.110 -r1.115 --- src/networks/donkey/donkeyGlobals.ml 26 Nov 2006 16:36:29 -0000 1.110 -+++ src/networks/donkey/donkeyGlobals.ml 4 Dec 2006 12:00:19 -0000 1.112 -@@ -595,8 +595,10 @@ ++++ src/networks/donkey/donkeyGlobals.ml 28 Jan 2007 20:26:46 -0000 1.115 +@@ -104,6 +104,7 @@ + let as_file file = as_file file.file_file + let file_priority file = file.file_file.impl_file_priority + let file_size file = file.file_file.impl_file_size ++let file_is_largefile f = file_size f > old_max_emule_file_size + let file_downloaded file = file_downloaded (as_file file) + let file_age file = file.file_file.impl_file_age + let file_fd file = file_fd (as_file file) +@@ -287,6 +288,12 @@ + + let connected_servers () = !connected_server_list + ++let logged_in_servers () = ++List.filter (fun s -> ++ match server_state s with ++ | Connected _ -> true ++ | _ -> false) !connected_server_list ++ + let get_udp_sock () = + match !udp_sock with + None -> failwith "No UDP socket" +@@ -595,16 +602,15 @@ client_osinfo = None; client_checked = false; client_connected = false; @@ -5496,9 +8573,17 @@ diff -u -r1.110 -r1.112 + client_total_downloaded = Int64.zero; + client_total_uploaded = Int64.zero; client_banned = false; - client_score = 0; - client_next_queue = 0; -@@ -650,8 +652,10 @@ +- client_score = 0; +- client_next_queue = 0; + client_rank = 0; + client_connect_time = 0; + client_requests_sent = 0; + client_requests_received = 0; +- client_indirect_address = None; + client_slot = SlotNotAsked; + client_debug = false; + client_pending_messages = []; +@@ -650,16 +656,15 @@ client_osinfo = None; client_checked = false; client_connected = false; @@ -5509,13 +8594,47 @@ diff -u -r1.110 -r1.112 + client_session_downloaded = Int64.zero; + client_session_uploaded = Int64.zero; client_banned = false; - client_score = 0; - client_next_queue = 0; -@@ -1018,6 +1022,6 @@ +- client_score = 0; +- client_next_queue = 0; + client_rank = 0; + client_connect_time = 0; + client_requests_received = 0; + client_requests_sent = 0; +- client_indirect_address = None; + client_slot = SlotNotAsked; + client_debug = Intset.mem s.DonkeySources.source_num !debug_clients; + client_pending_messages = []; +@@ -715,17 +720,6 @@ + let friend_add c = + friend_add (as_client c) + +-let string_of_client c = +- Printf.sprintf "client[%d] %s(%s) %s" (client_num c) +- c.client_name (brand_to_string c.client_brand) +- (match c.client_kind with +- Indirect_address (server_ip, server_port, ip, port, real_ip) -> +- Printf.sprintf " I[%s:%d]" (Ip.to_string real_ip) port; +- | Direct_address (ip,port) -> +- Printf.sprintf " D[%s:%d]" (Ip.to_string ip) port; +- | Invalid_address _ -> "" +- ) +- + let string_of_server s = + Printf.sprintf "%s:%d" (Ip.to_string s.server_ip) s.server_port + +@@ -1017,7 +1011,13 @@ + let full_client_identifier c = Printf.sprintf "%s (%s%s) '%s'" - (Ip.to_string c.client_ip) +- (Ip.to_string c.client_ip) - (brand_to_string_short c.client_brand) ++ (match c.client_kind with ++ Indirect_address (server_ip, server_port, ip, port, real_ip) -> ++ Printf.sprintf "%s:%d(lowID, server:%s:%d]" ++ (Ip.to_string real_ip) port (Ip.to_string server_ip) server_port; ++ | Direct_address (ip,port) -> ++ Printf.sprintf "%s:%d" (Ip.to_string ip) port; ++ | Invalid_address _ -> " invalid IP") + (GuiTypes.client_software_short (brand_to_string_short c.client_brand) c.client_osinfo) (if c.client_emule_proto.emule_release = "" then "" else " " ^ c.client_emule_proto.emule_release) (String.escaped c.client_name) @@ -5627,10 +8746,10 @@ Index: src/networks/donkey/donkeyInteractive.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml,v retrieving revision 1.140 -retrieving revision 1.145 -diff -u -r1.140 -r1.145 +retrieving revision 1.149 +diff -u -r1.140 -r1.149 --- src/networks/donkey/donkeyInteractive.ml 26 Nov 2006 17:27:40 -0000 1.140 -+++ src/networks/donkey/donkeyInteractive.ml 6 Dec 2006 22:33:05 -0000 1.145 ++++ src/networks/donkey/donkeyInteractive.ml 30 Jan 2007 21:23:01 -0000 1.149 @@ -113,44 +113,44 @@ let server = check_add_server r.S.ip r.S.port in List.iter (fun tag -> @@ -5703,7 +8822,16 @@ diff -u -r1.140 -r1.145 CommonSwarming.set_absent swarmer absents end; -@@ -447,16 +448,16 @@ +@@ -429,6 +430,8 @@ + filename_met := Some s; + | { tag_name = Field_Size; tag_value = Uint64 v } -> + size := v ++ | { tag_name = Field_Size_Hi; tag_value = Uint64 v } -> ++ size := Int64.logor !size (Int64.shift_left v 32) + | _ -> () + ) f.P.tags; + ignore (really_query_download +@@ -447,16 +450,16 @@ List.iter (fun tag -> match tag with @@ -5723,7 +8851,31 @@ diff -u -r1.140 -r1.145 if Sys.file_exists s then (* be careful on that *) temp_dir := s else (lprintf_nl "Bad temp directory, using default"; -@@ -797,7 +798,7 @@ +@@ -559,8 +562,9 @@ + | "ed2k://" :: "file" :: name :: size :: md4 :: "/" :: "sources" :: sources :: _ + | "file" :: name :: size :: md4 :: "/" :: "sources" :: sources :: _ -> + (* ed2k://|file|Wikipedia_3.3_noimages.iso|2666311680|747735CD46B61DA92973E9A8840A9C99|/|sources,62.143.4.124:4662|/ *) +- if Int64.of_string size >= 4294967295L then +- (Printf.sprintf (_b "Files > 4GB are not allowed")), false ++ if Int64.of_string size >= max_emule_file_size then ++ (Printf.sprintf (_b "Files > %s are not allowed") ++ (Int64ops.int64_to_human_readable max_emule_file_size)), false + else + begin + let md4 = if String.length md4 > 32 then +@@ -599,8 +603,9 @@ + end + | "ed2k://" :: "file" :: name :: size :: md4 :: _ + | "file" :: name :: size :: md4 :: _ -> +- if Int64.of_string size >= 4294967295L then +- (Printf.sprintf (_b "Files > 4GB are not allowed")), false ++ if Int64.of_string size >= max_emule_file_size then ++ (Printf.sprintf (_b "Files > %s are not allowed") ++ (Int64ops.int64_to_human_readable max_emule_file_size)), false + else + let md4 = if String.length md4 > 32 then + String.sub md4 0 32 else md4 in +@@ -797,9 +802,10 @@ ) !current_files ) args; "" @@ -5731,26 +8883,76 @@ diff -u -r1.140 -r1.145 + ) , "<f1> <f2> ... :\t\ttry to recover these files at byte level"; "preferred", Arg_two (fun arg1 arg2 o -> ++ if CommonUserDb.user2_is_admin o.conn_user.ui_user then let preferred = bool_of_string arg1 in -@@ -809,7 +810,7 @@ + let ip = Ip.of_string arg2 in + Hashtbl.iter (fun ip_s s -> +@@ -809,19 +815,28 @@ end ) servers_by_key; "ok" - ), "<true/false> <ip> :\t\tset the server with this IP as preferred"; ++ else ++ _s "You are not allowed to change preferred status" + ), "<true|false> <ip> :\t\tset the server with this IP as preferred"; "bs", Arg_multiple (fun args o -> ++ if CommonUserDb.user2_is_admin o.conn_user.ui_user then begin List.iter (fun arg -> -@@ -817,7 +818,7 @@ + let range = Ip.range_of_string arg in server_black_list =:= range :: !!server_black_list; ) args; "done" - ), "<range1> <range2> ... :\t\t\tadd these IPs to the servers black list (can be single IPs, CIDR ranges or begin-end ranges)"; ++ end else ++ _s "You are not allowed to blacklist servers" + ), "<range1> <range2> ... :\t\tadd these IPs to the servers black list (can be single IPs, CIDR ranges or begin-end ranges)"; "port", Arg_one (fun arg o -> ++ if CommonUserDb.user2_is_admin o.conn_user.ui_user then begin donkey_port =:= int_of_string arg; -@@ -1195,9 +1196,10 @@ +- "new port will change at next restart"), ++ "new port will change at next restart" ++ end else ++ _s "You are not allowed to change connection port" ++ ), + "<port> :\t\t\t\tchange connection port"; + + "scan_temp", Arg_none (fun o -> +@@ -925,7 +940,7 @@ + if use_html_mods o then Printf.bprintf buf "\\</table\\>\\</div\\>"; + "" end + else begin +- print_command_result o o.conn_buf "You are not allowed to use scan_temp"; ++ print_command_result o "You are not allowed to use scan_temp"; + "" end + + ), ":\t\t\t\tprint temp directory content"; +@@ -935,7 +950,7 @@ + DonkeySources.print o.conn_buf o.conn_output; + "" end + else begin +- print_command_result o o.conn_buf "You are not allowed to list sources"; ++ print_command_result o "You are not allowed to list sources"; + "" end + ), ":\t\t\t\tshow sources currently known"; + +@@ -991,11 +1006,14 @@ + ), ":\t\t\t\treset client_md4/client_private_key to random values"; + + "bp", Arg_multiple (fun args o -> ++ if CommonUserDb.user2_is_admin o.conn_user.ui_user then begin + List.iter (fun arg -> + let port = int_of_string arg in + port_black_list =:= port :: !!port_black_list; + ) args; + "done" ++ end else ++ _s "You are not allowed to blacklist ports" + ), "<port1> <port2> ... :\t\tadd these ports to the port black list"; + ] + +@@ -1195,14 +1213,16 @@ P.client_os = c.client_osinfo; P.client_release = c.client_emule_proto.emule_release; P.client_emulemod = brand_mod_to_string_short c.client_brand_mod; @@ -5764,7 +8966,13 @@ diff -u -r1.140 -r1.145 P.client_upload = (match client_upload (as_client c) with Some f -> Some (CommonFile.file_best_name f) -@@ -1396,8 +1398,10 @@ + | None -> None); + P.client_sui_verified = c.client_sui_verified; ++ P.client_file_queue = List.map (fun (file,_,_) -> as_file file) c.client_file_queue + } + ); + client_ops.op_client_debug <- (fun c debug -> +@@ -1396,8 +1416,10 @@ ( "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 []) @ [ @@ -5777,7 +8985,7 @@ diff -u -r1.140 -r1.145 ( "1", "srh ar", "Your queue rank on this client", "Rnk" ) ; ( "1", "srh ar br", "Source score", "Scr" ) ; ( "1", "srh ar br", "Last ok", "LO" ) ; -@@ -1476,8 +1480,10 @@ +@@ -1476,8 +1498,10 @@ )); ("", "sr br", ip_string); ] @ (if !Geoip.active then [(cn, "sr br", cc)] else []) @ [ @@ -5790,7 +8998,76 @@ diff -u -r1.140 -r1.145 ("", "sr ar", Printf.sprintf "%d" c.client_rank); ("", "sr ar br", Printf.sprintf "%d" c.client_source.DonkeySources.source_score); ("", "sr ar br", (string_of_date (c.client_source.DonkeySources.source_age))); -@@ -1698,10 +1704,10 @@ +@@ -1679,6 +1703,68 @@ + c.client_name + (string_of_date (c.client_source.DonkeySources.source_age)) + ); ++ client_ops.op_client_print_info <- (fun c o -> ++ let buf = o.conn_buf in ++ let ip_string,cc,cn = get_ips_cc_cn c in ++ ++ Printf.bprintf buf "Client %d: %s\n" ++ (client_num c) ++ (full_client_identifier c); ++ ( ++ match c.client_osinfo with ++ | Some i -> Printf.bprintf buf " osinfo: %s\n" i ++ | None -> () ++ ); ++ Printf.bprintf buf " state: %s, rank: %d\n" ++ (string_of_connection_state (client_state c)) c.client_rank; ++ if !Geoip.active then Printf.bprintf buf " country: %s: %s\n" cc cn; ++ Printf.bprintf buf " MD4: %s\n" (Md4.to_string c.client_md4); ++ Printf.bprintf buf " downloaded\n"; ++ Printf.bprintf buf " - session %s\n" (size_of_int64 c.client_session_downloaded); ++ Printf.bprintf buf " - total %s\n" (size_of_int64 c.client_total_downloaded); ++ ( ++ match c.client_download with ++ | Some (f,_) -> Printf.bprintf buf " downloading file %s\n" (file_best_name f) ++ | None -> Printf.bprintf buf " not downloading\n" ++ ); ++ Printf.bprintf buf " uploaded\n"; ++ Printf.bprintf buf " - session %s\n" (size_of_int64 c.client_session_uploaded); ++ Printf.bprintf buf " - total %s\n" (size_of_int64 c.client_total_uploaded); ++ ( ++ match c.client_upload with ++ | Some u -> Printf.bprintf buf " uploading file %s\n" (file_best_name u.up_file) ++ | _ -> Printf.bprintf buf " not uploading\n" ++ ); ++ Printf.bprintf buf " SUI %s\n" ( ++ match c.client_sui_verified with ++ | None -> "not supported" ++ | Some b -> if b then "passed" else "failed" ++ ); ++ Printf.bprintf buf " kind: %s\n" ( ++ match c.client_kind with ++ | Direct_address (ip,port) -> ++ Printf.sprintf "highID %s:%d" (Ip.to_string ip) port ++ | Indirect_address (server_ip, server_port, id, port, real_ip) -> ++ Printf.sprintf "lowID %s:%d, server %s:%d" ++ (Ip.to_string real_ip) port (Ip.to_string server_ip) server_port ++ | Invalid_address (name,md4) -> Printf.sprintf "invalid" ++ ); ++ if c.client_emule_proto.received_miscoptions1 then ++ Printf.bprintf buf "\nmiscoptions1:\n%s" (DonkeyProtoClient.print_emule_proto_miscoptions1 c.client_emule_proto) ++ else ++ Printf.bprintf buf "no miscoptions1 received\n"; ++ if c.client_emule_proto.received_miscoptions2 then ++ Printf.bprintf buf "miscoptions2:\n%s" (DonkeyProtoClient.print_emule_proto_miscoptions2 c.client_emule_proto) ++ else ++ Printf.bprintf buf "no miscoptions2 received\n"; ++ List.iter (fun (file,_,_) -> Printf.bprintf buf "\nQueue: %s" (file_best_name file)) c.client_file_queue; ++ List.iter (fun r -> ++ Printf.bprintf buf "\nSource file: %s, score %d, request time %d" ++ (CommonFile.file_best_name (r.DonkeySources.request_file.DonkeySources.manager_file ())) ++ r.DonkeySources.request_score ++ r.DonkeySources.request_time; ++ ) c.client_source.DonkeySources.source_files; ++ ); + client_ops.op_client_dprint <- (fun c o file -> + let info = file_info file in + let buf = o.conn_buf in +@@ -1698,10 +1784,10 @@ Direct_address (ip,port) -> (Ip.to_string ip) | _ -> (string_of_client_addr c)); Printf.bprintf buf "\n%14sDown : %-10s Uploaded: %-10s Ratio: %s%1.1f (%s)\n" "" @@ -5805,7 +9082,7 @@ diff -u -r1.140 -r1.145 (brand_to_string c.client_brand); (Printf.bprintf buf "%14sFile : %s\n" "" info.GuiTypes.file_name); end; -@@ -1754,8 +1760,10 @@ +@@ -1754,8 +1840,10 @@ )); ("", "sr", ip_string); ] @ (if !Geoip.active then [(cn, "sr", cc)] else []) @ [ @@ -5818,7 +9095,7 @@ diff -u -r1.140 -r1.145 ("", "sr", info.GuiTypes.file_name) ]); Printf.bprintf buf "\\</tr\\>"; -@@ -1774,6 +1782,29 @@ +@@ -1774,6 +1862,29 @@ ) let _ = @@ -5852,10 +9129,10 @@ Index: src/networks/donkey/donkeyMain.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyMain.ml,v retrieving revision 1.63 -retrieving revision 1.64 -diff -u -r1.63 -r1.64 +retrieving revision 1.67 +diff -u -r1.63 -r1.67 --- src/networks/donkey/donkeyMain.ml 26 Nov 2006 16:36:29 -0000 1.63 -+++ src/networks/donkey/donkeyMain.ml 3 Dec 2006 20:49:42 -0000 1.64 ++++ src/networks/donkey/donkeyMain.ml 28 Jan 2007 20:39:59 -0000 1.67 @@ -137,14 +137,14 @@ let emule_compatoptions = D.emule_compatoptions m in client_to_client_tags := @@ -5879,7 +9156,15 @@ diff -u -r1.63 -r1.64 ]; (* server capabilities *) -@@ -161,42 +161,42 @@ +@@ -154,49 +154,49 @@ + extended := !extended lor 0x04; (* support of auxport *) + extended := !extended lor 0x08; (* newtags *) + (*extended := !extended lor 0x10; (* unicode *) *) +-(*extended := !extended lor 0x100; (* files > 4GB *) *) ++ extended := !extended lor 0x100; (* files > 4GB *) + (*extended := !extended lor 0x200; (* support crypt *) *) + (*extended := !extended lor 0x400; (* request crypt *) *) + (*extended := !extended lor 0x800; (* require crypt *) *) client_to_server_tags := [ @@ -5944,14 +9229,26 @@ diff -u -r1.63 -r1.64 ] let enable () = +@@ -405,7 +405,10 @@ + !kademlia_port_info, "kademlia_port UDP"; + ]); + network.op_network_porttest_result <- +- (fun _ -> !DonkeyInteractive.porttest_result); ++ (fun _ -> match !DonkeyInteractive.porttest_result with ++ | PorttestResult (time, s) -> ++ PorttestResult (time, (String2.dehtmlize s)) ++ | _ -> !DonkeyInteractive.porttest_result); + CommonInteractive.register_gui_options_panel "eDonkey" + gui_donkey_options_panel; + CommonInteractive.register_gui_options_panel "Overnet" Index: src/networks/donkey/donkeyMftp.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyMftp.ml,v retrieving revision 1.13 -retrieving revision 1.15 -diff -u -r1.13 -r1.15 +retrieving revision 1.17 +diff -u -r1.13 -r1.17 --- src/networks/donkey/donkeyMftp.ml 9 Feb 2006 11:45:12 -0000 1.13 -+++ src/networks/donkey/donkeyMftp.ml 4 Dec 2006 12:00:19 -0000 1.15 ++++ src/networks/donkey/donkeyMftp.ml 15 Jan 2007 21:32:56 -0000 1.17 @@ -179,7 +179,9 @@ List.assoc name names_of_tag with Not_found -> @@ -5963,7 +9260,15 @@ diff -u -r1.13 -r1.15 tag_value = v }, pos -@@ -223,3 +225,75 @@ +@@ -211,6 +213,7 @@ + "\005", Field_Lastseencomplete; + "\021", Field_Availability; + "\048", Field_Completesources; ++ "\058", Field_Size_Hi; + "\208", Field_Artist; + "\209", Field_Album; + "\210", Field_Title; +@@ -223,3 +226,77 @@ "Album", Field_Album; "Title", Field_Title; ] @@ -5998,6 +9303,7 @@ diff -u -r1.13 -r1.15 + "\092", "mod_secure_community"; + "\093", "mod_unknown0x5d"; + "\096", "mod_unknown0x60"; ++ "\100", "mod_unknown0x64"; + "\102", "mod_fusion"; + "\103", "mod_fusion_version"; + @@ -6005,6 +9311,7 @@ diff -u -r1.13 -r1.15 + "\105", "edonkeyclc serverip?"; + "\106", "edonkeyclc serverport?"; + ++ "\108", "mod_unknown0x6c"; + "\117", "mod_unknown0x75"; (* http://emule-project.net @ NewMule *) + "\118", "mod_unknown0x76"; + "\119", "mod_tarod"; @@ -6055,14 +9362,248 @@ diff -u -r1.6 -r1.7 \ No newline at end of file +val file_common_tags : (string * CommonTypes.field) list +val client_common_tags : (string * string) list -Index: src/networks/donkey/donkeyPandora.ml +Index: src/networks/donkey/donkeyOneFile.ml =================================================================== -RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyPandora.ml,v +RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOneFile.ml,v +retrieving revision 1.46 +retrieving revision 1.49 +diff -u -r1.46 -r1.49 +--- src/networks/donkey/donkeyOneFile.ml 21 Nov 2006 22:34:34 -0000 1.46 ++++ src/networks/donkey/donkeyOneFile.ml 15 Jan 2007 18:28:03 -0000 1.49 +@@ -100,11 +100,30 @@ + end + + let remove_client_slot c = ++ if c.client_debug || ( ++ !verbose && ++ (c.client_session_uploaded > 0L || c.client_session_downloaded > 0L)) then ++ lprintf_nl "Client[%d] %s disconnected, connected %s%s%s" ++ (client_num c) (full_client_identifier c) ++ (Date.time_to_string (last_time () - c.client_connect_time) "verbose") ++ (if c.client_total_uploaded > 0L then ++ Printf.sprintf ", send %s (%s)%s" ++ (size_of_int64 c.client_session_uploaded) ++ (size_of_int64 c.client_total_uploaded) ++ (match client_upload (as_client c) with | None -> "" ++ | Some f -> " of " ^ (CommonFile.file_best_name f)) else "") ++ (if c.client_total_downloaded > 0L then ++ Printf.sprintf ", rec %s (%s)%s" ++ (size_of_int64 c.client_session_downloaded) ++ (size_of_int64 c.client_total_downloaded) ++ (match c.client_download with | None -> "" ++ | Some (f,_) -> " of " ^ (file_best_name f)) else ""); + set_client_has_a_slot (as_client c) NoSlot; + client_send c ( + let module M = DonkeyProtoClient in +- let module Q = M.CloseSlot in +- M.CloseSlotReq Q.t); ++ let module Q = M.OutOfParts in ++ M.OutOfPartsReq Q.t); ++ c.client_session_uploaded <- 0L; + c.client_upload <- None + + let unshare_file file = +@@ -218,16 +237,17 @@ + + (* let next_file _ = failwith "next_file not implemented" *) + +-(* clean_client_zones: clean all structures related to downloads when +- a client disconnects *) +-let clean_current_download c = +- match c.client_download with +- None -> () +- | Some (file, up) -> +- CommonSwarming.unregister_uploader up; +- c.client_download <- None +- + let send_get_range_request c file ranges = ++ let rec check_large (rangelist : (int64 * int64 * range) list) = ++ match rangelist with ++ | [] -> false ++ | (x,y,_ : (int64 * int64 * range))::tail_range -> ++ (x > old_max_emule_file_size) || (y > old_max_emule_file_size) || (check_large tail_range) ++ in ++ let is_large_request = check_large ranges in ++ if file_is_largefile file && c.client_emule_proto.emule_largefiles <> 1 then ++ lprintf_nl "File %s is too large for %s." (file_best_name file) (full_client_identifier c) ++ else + match c.client_source.DonkeySources.source_sock with + | Connection sock -> + +@@ -239,6 +259,7 @@ + [x1,y1,_] -> + { + Q.md4 = file.file_md4; ++ Q.usesixtyfour = is_large_request; + Q.start_pos1 = x1; + Q.end_pos1 = y1; + Q.start_pos2 = zero; +@@ -250,6 +271,7 @@ + | [x1,y1,_; x2,y2,_] -> + { + Q.md4 = file.file_md4; ++ Q.usesixtyfour = is_large_request; + Q.start_pos1 = x1; + Q.end_pos1 = y1; + Q.start_pos2 = x2; +@@ -261,6 +283,7 @@ + | [x1,y1,_; x2,y2,_; x3,y3,_ ] -> + { + Q.md4 = file.file_md4; ++ Q.usesixtyfour = is_large_request; + Q.start_pos1 = x1; + Q.end_pos1 = y1; + Q.start_pos2 = x2; +@@ -377,9 +400,7 @@ + or start querying blocks if already in the queue *) + let request_slot c = + if c.client_slot = SlotNotAsked then begin +- if !verbose_download then begin +- lprintf_nl "start_download"; +- end; ++ if !verbose_download then lprintf_nl "start_download"; + do_if_connected c.client_source.DonkeySources.source_sock (fun sock -> + sort_file_queue c; + match c.client_file_queue with +@@ -472,8 +493,9 @@ + match tag with + { tag_name = Field_Filename; tag_value = String s } -> file_name := s + | { tag_name = Field_Size; tag_value = Uint64 v } -> file_size := v +- | { tag_name = Field_Availability; +- tag_value = (Uint64 v| Fint64 v) } -> ++ | { tag_name = Field_Size_Hi; tag_value = Uint8 v } -> ++ file_size := Int64.logor !file_size (Int64.shift_left (Int64.of_int v) 32) ++ | { tag_name = Field_Availability; tag_value = (Uint64 v| Fint64 v) } -> + availability := Int64.to_int v; new_tags := tag :: !new_tags + | _ -> new_tags := tag :: !new_tags + ) tags; +Index: src/networks/donkey/donkeyOneFile.mli +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOneFile.mli,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 +--- src/networks/donkey/donkeyOneFile.mli 12 Nov 2005 11:20:21 -0000 1.7 ++++ src/networks/donkey/donkeyOneFile.mli 15 Jan 2007 18:28:03 -0000 1.8 +@@ -20,7 +20,6 @@ + open CommonSwarming + open Md4 + +-val clean_current_download : DonkeyTypes.client -> unit + val get_from_client : DonkeyTypes.client -> unit + val request_slot : DonkeyTypes.client -> unit + val check_files_downloaded : unit -> unit +Index: src/networks/donkey/donkeyOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOptions.ml,v +retrieving revision 1.57 +retrieving revision 1.61 +diff -u -r1.57 -r1.61 +--- src/networks/donkey/donkeyOptions.ml 26 Nov 2006 16:36:29 -0000 1.57 ++++ src/networks/donkey/donkeyOptions.ml 15 Jan 2007 18:26:27 -0000 1.61 +@@ -30,6 +30,7 @@ + int_option 30 + + let donkey_port = define_option donkey_section ["port"] ++ ~restart: true + "The port used for connection by other donkey clients." + int_option (2000 + Random.int 20000) + +@@ -174,6 +175,16 @@ + "How long a downloading client can stay in my upload queue (in minutes >5)" + int_option 90 + ++let upload_full_chunks = define_expert_option donkey_section ["upload_full_chunks"] ++ "If true, each client is allowed to receive one chunk, this setting overrides upload_lifetime" ++ bool_option false ++ ++let upload_complete_chunks = define_expert_option donkey_section ["upload_complete_chunks"] ++ "If true, each client is allowed to complete only one chunk, independent, if it is empty or ++ partial. this setting overrides upload_full_chunks and dynamic_upload_lifetime, ++ but is, as a failsafe, limited by upload_lifetime (should be set reasonable high)" ++ bool_option false ++ + let dynamic_upload_lifetime = define_expert_option donkey_section ["dynamic_upload_lifetime"] + "Each client upload lifetime depends on download-upload ratio" + bool_option false +@@ -182,6 +193,48 @@ + "Uploaded zones (1 zone = 180 kBytes) needed to enable the dynamic upload lifetime" + int_option 10 + ++let upload_compression = define_expert_option donkey_section ["upload_compression"] ++ "Enables compressed upload as part of the protocol" ++ bool_option true ++ ++let upload_compression_threshold = define_expert_option donkey_section ["upload_compression_threshold"] ++ "Sizedifference in bytes between one zone (180 kBytes) and its compressed ++ counterpart, which has to occure, to send compressed parts instead of plain." ++ int_option 2000 ++ ++let _ = ++ option_hook upload_compression_threshold (fun _ -> ++ if !!upload_compression_threshold < 0 then ++ upload_compression_threshold =:= 0 ++ ) ++ ++let upload_compression_level = define_expert_option donkey_section ["upload_compression_level"] ++ "Level of the used zlibcompression. allowed are values between 0 and 9. higher ++ level means better compression, but higher cpu usage too. (emules default ++ compression level for compressed parts is 9)" ++ int_option 9 ++ ++let _ = ++ option_hook upload_compression_level (fun _ -> ++ if !!upload_compression_level < 0 ++ || !!upload_compression_level > 9 then ++ upload_compression_level =:= 9 ++ ) ++ ++let upload_compression_table_size = define_expert_option donkey_section ["upload_compression_table_size"] ++ ~restart: true ++ "Size of the cache table in entries (ca. 2 * 180 kbytes). zones have to be ++ compressed at once, but only parts of it are sent at a time (10 kbytes). ++ to reduce diskaccess and repeated compression to a minimum, size should be ++ at least the number of total upload slots. restart of core is required." ++ int_option 20 ++ ++let _ = ++ option_hook upload_compression_table_size (fun _ -> ++ if !!upload_compression_table_size < 1 then ++ upload_compression_table_size =:= 1 ++ ) ++ + let connected_server_timeout = define_expert_option donkey_section ["connected_server_timeout"] + "How long can a silent server stay connected" + float_option 1800. +@@ -200,6 +253,7 @@ + int_option 2 + + let remove_old_servers_delay = define_expert_option donkey_section ["remove_old_servers_delay"] ++ ~restart: true + "How often should remove old donkey servers (see max_server_age) be called + (in seconds, 0 to disable)" + float_option 900. +@@ -267,10 +321,12 @@ + "Overnet options" + + let overnet_port = define_option overnet_section [overnet_options_section_name; "port"] ++ ~restart: true + "port for overnet" + int_option (2000 + Random.int 20000) + + let options_version = define_expert_option donkey_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 3 + +Index: src/networks/donkey/donkeyPandora.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyPandora.ml,v +retrieving revision 1.7 +retrieving revision 1.9 +diff -u -r1.7 -r1.9 --- src/networks/donkey/donkeyPandora.ml 3 Apr 2006 20:50:09 -0000 1.7 -+++ src/networks/donkey/donkeyPandora.ml 3 Dec 2006 20:49:42 -0000 1.8 ++++ src/networks/donkey/donkeyPandora.ml 6 Jan 2007 18:15:17 -0000 1.9 @@ -98,23 +98,23 @@ let update_emule_proto_from_tags e tags = List.iter (fun tag -> @@ -6094,24 +9635,71 @@ diff -u -r1.7 -r1.8 for_int_tag tag (fun i -> e.emule_secident <- i land 0x3) | s -> -@@ -138,7 +138,7 @@ +@@ -138,12 +138,23 @@ begin try - let options = find_tag (Field_UNKNOWN "emule_miscoptions1") tags in + let options = find_tag (Field_KNOWN "emule_miscoptions1") tags in ++ ( match options with - Uint64 v | Fint64 v -> +- Uint64 v | Fint64 v -> ++ | Uint64 v | Fint64 v -> update_emule_proto_from_miscoptions1 emule v + | _ -> + lprintf "CANNOT INTERPRETE EMULE OPTIONS\n" ++ ); ++ ++ let options2 = find_tag (Field_KNOWN "emule_miscoptions2") tags in ++ ( ++ match options2 with ++ | Uint64 v | Fint64 v -> ++ update_emule_proto_from_miscoptions2 emule v ++ | _ -> ++ lprintf "CANNOT INTERPRETE EMULE OPTIONS2\n" ++ ); + + with _ -> () + end; +@@ -151,14 +162,14 @@ + | P.UnknownReq (227,_) -> + emule.emule_extendedrequest <- -1 + +- | P.EmuleCompressedPart (md4, statpos, newsize, bloc) -> ++ | P.EmuleCompressedPart t -> + + let comp = match c.client_comp with + None -> + let comp = { +- comp_md4 = md4; +- comp_pos = statpos; +- comp_total = Int64.to_int newsize; ++ comp_md4 = t.EmuleCompressedPart.md4; ++ comp_pos = t.EmuleCompressedPart.statpos; ++ comp_total = Int64.to_int t.EmuleCompressedPart.newsize; + comp_len = 0; + comp_blocs = []; + } in +@@ -166,8 +177,8 @@ + comp + | Some comp -> comp + in +- comp.comp_blocs <- bloc :: comp.comp_blocs; +- comp.comp_len <- comp.comp_len + String.length bloc; ++ comp.comp_blocs <- t.EmuleCompressedPart.bloc :: comp.comp_blocs; ++ comp.comp_len <- comp.comp_len + String.length t.EmuleCompressedPart.bloc; + + (* lprintf "Comp bloc: %d/%d\n" comp.comp_len comp.comp_total; *) + if comp.comp_len = comp.comp_total then begin Index: src/networks/donkey/donkeyProtoClient.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoClient.ml,v retrieving revision 1.40 -retrieving revision 1.42 -diff -u -r1.40 -r1.42 +retrieving revision 1.45 +diff -u -r1.40 -r1.45 --- src/networks/donkey/donkeyProtoClient.ml 26 Nov 2006 16:36:29 -0000 1.40 -+++ src/networks/donkey/donkeyProtoClient.ml 3 Dec 2006 20:49:42 -0000 1.42 -@@ -39,41 +39,84 @@ ++++ src/networks/donkey/donkeyProtoClient.ml 8 Jan 2007 12:20:40 -0000 1.45 +@@ -39,67 +39,110 @@ (int_of_string(Autoconf.minor_version) lsl 10) lor (int_of_string(Autoconf.sub_version) lsl 7) @@ -6132,6 +9720,7 @@ diff -u -r1.40 -r1.42 + emule_features = 3; + +(* emule_miscoptions1 *) ++ received_miscoptions1 = false; + emule_aich = 0; + emule_unicode = 0; + emule_udpver = 0; @@ -6149,11 +9738,12 @@ diff -u -r1.40 -r1.42 + emule_supportpreview = 0; + +(* emule_miscoptions2 *) ++ received_miscoptions2 = false; + emule_require_crypt = 0; + emule_request_crypt = 0; + emule_support_crypt = 0; + emule_extmultipacket = 0; -+ emule_largefiles = 0; ++ emule_largefiles = 1; + emule_kad_version = 0; } @@ -6206,14 +9796,17 @@ diff -u -r1.40 -r1.42 + Buffer.contents buf + let emule_miscoptions2 m = - (* +-(* let o = -@@ -83,23 +126,24 @@ - *) - Int64.zero + (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 ++let update_emule_proto_from_miscoptions2 m o = + let o = Int64.to_int o in - m.emule_udpver <- (o lsr 24) land 0xf; - m.emule_compression <- (o lsr 20) land 0xf; - m.emule_secident <- (o lsr 16) land 0xf; @@ -6226,8 +9819,7 @@ diff -u -r1.40 -r1.42 - -let update_emule_proto_from_miscoptions2 m o = () -(* -+let update_emule_proto_from_miscoptions2 m o = - let o = Int64.to_int o in +- let o = Int64.to_int o in - m.emule_largefiles <- (o lsr 4) land 0x1 -*) + m.emule_require_crypt <- (o lsr 9) land 0x1; @@ -6249,7 +9841,7 @@ diff -u -r1.40 -r1.42 let emule_compatoptions m = (m.emule_osinfosupport lsl 0) -@@ -146,23 +190,10 @@ +@@ -146,23 +189,10 @@ left_bytes : string; } @@ -6276,7 +9868,123 @@ diff -u -r1.40 -r1.42 let parse reply len s = let hash_len, pos = if not reply then get_uint8 s 1, 2 else -1, 1 in -@@ -787,49 +818,10 @@ +@@ -388,7 +418,6 @@ + + let print t = + lprintf_nl "CHUNKS for %s" (Md4.to_string t.md4); +- lprint_string " "; + lprintf_nl "%s\n" (Bitv.to_string t.chunks) + + let write buf t = +@@ -423,7 +452,7 @@ + } + + let print t = +- lprintf_nl "CHUNKS for %s" (Md4.to_string t.md4); ++ lprintf_nl "CHUNKSMd4 for %s" (Md4.to_string t.md4); + lprint_string " "; + Array.iter (fun b -> + lprintf " %s" (Md4.to_string b)) +@@ -462,6 +491,7 @@ + module Bloc = struct + type t = { + md4 : Md4.t; ++ usesixtyfour : bool; + start_pos : int64; + end_pos: int64; + bloc_str: string; +@@ -469,14 +499,15 @@ + bloc_len : int; + } + +- let parse len s = ++ let parse usesixtyfour len s = + { + md4 = get_md4 s 1; +- start_pos = get_uint64_32 s 17; +- end_pos = get_uint64_32 s 21; ++ usesixtyfour = usesixtyfour; ++ start_pos = if usesixtyfour then get_int64 s 17 else get_uint64_32 s 17; ++ end_pos = if usesixtyfour then get_int64 s 25 else get_uint64_32 s 21; + bloc_str = s; +- bloc_begin = 25; +- bloc_len = len - 25; ++ bloc_begin = if usesixtyfour then 33 else 25; ++ bloc_len = if usesixtyfour then len - 33 else len - 25; + } + + let print t = +@@ -487,14 +518,15 @@ + + let write buf t = + buf_md4 buf t.md4; +- buf_int64_32 buf t.start_pos; +- buf_int64_32 buf t.end_pos; ++ if t.usesixtyfour then buf_int64 buf t.start_pos else buf_int64_32 buf t.start_pos; ++ if t.usesixtyfour then buf_int64 buf t.end_pos else buf_int64_32 buf t.end_pos; + Buffer.add_substring buf t.bloc_str t.bloc_begin t.bloc_len + end + + module QueryBloc = struct + type t = { + md4 : Md4.t; ++ usesixtyfour : bool; + start_pos1 : int64; (* 180 ko *) + end_pos1: int64; + start_pos2 : int64; +@@ -503,15 +535,16 @@ + end_pos3: int64; + } + +- let parse len s = ++ let parse usesixtyfour len s = + { + md4 = get_md4 s 1; +- start_pos1 = get_uint64_32 s 17; +- end_pos1 = get_uint64_32 s 29; +- start_pos2 = get_uint64_32 s 21; +- end_pos2 = get_uint64_32 s 33; +- start_pos3 = get_uint64_32 s 25; +- end_pos3 = get_uint64_32 s 37; ++ usesixtyfour = usesixtyfour; ++ start_pos1 = if usesixtyfour then get_int64 s 17 else get_uint64_32 s 17; ++ end_pos1 = if usesixtyfour then get_int64 s 41 else get_uint64_32 s 29; ++ start_pos2 = if usesixtyfour then get_int64 s 25 else get_uint64_32 s 21; ++ end_pos2 = if usesixtyfour then get_int64 s 49 else get_uint64_32 s 33; ++ start_pos3 = if usesixtyfour then get_int64 s 33 else get_uint64_32 s 25; ++ end_pos3 = if usesixtyfour then get_int64 s 57 else get_uint64_32 s 37; + } + + let print t = +@@ -523,12 +556,12 @@ + + let write buf t = + buf_md4 buf t.md4; +- buf_int64_32 buf t.start_pos1; +- buf_int64_32 buf t.start_pos2; +- buf_int64_32 buf t.start_pos3; +- buf_int64_32 buf t.end_pos1; +- buf_int64_32 buf t.end_pos2; +- buf_int64_32 buf t.end_pos3 ++ if t.usesixtyfour then buf_int64 buf t.start_pos1 else buf_int64_32 buf t.start_pos1; ++ if t.usesixtyfour then buf_int64 buf t.start_pos2 else buf_int64_32 buf t.start_pos2; ++ if t.usesixtyfour then buf_int64 buf t.start_pos3 else buf_int64_32 buf t.start_pos3; ++ if t.usesixtyfour then buf_int64 buf t.end_pos1 else buf_int64_32 buf t.end_pos1; ++ if t.usesixtyfour then buf_int64 buf t.end_pos2 else buf_int64_32 buf t.end_pos2; ++ if t.usesixtyfour then buf_int64 buf t.end_pos3 else buf_int64_32 buf t.end_pos3 + end + + let unit = () +@@ -554,7 +587,7 @@ + + module AvailableSlot = NoArg(struct let m = "AvailableSlot" end) + module ReleaseSlot = NoArg(struct let m = "ReleaseSlot" end) +-module CloseSlot = NoArg(struct let m = "CloseSlot" end) ++module OutOfParts = NoArg(struct let m = "OutOfParts" end) + module ViewFiles = NoArg(struct let m = "VIEW FILES" end) + module ViewDirs = NoArg(struct let m = "VIEW DIRS" end) + +@@ -787,49 +820,10 @@ mutable tags : tag list; } @@ -6328,15 +10036,213 @@ diff -u -r1.40 -r1.42 let parse len s = let version = get_uint8 s 1 in +@@ -1090,6 +1084,35 @@ + buf_string buf t.comment + end + ++module EmuleCompressedPart = struct ++ ++ type t = { ++ md4 : Md4.t; ++ usesixtyfour : bool; ++ statpos : int64; ++ newsize : int64; ++ bloc : string; ++ } ++ ++ let parse usesixtyfour len s = ++ { ++ md4 = get_md4 s 1; ++ usesixtyfour = usesixtyfour; ++ statpos = if usesixtyfour then get_int64 s 17 else get_uint64_32 s 17; ++ newsize = if usesixtyfour then get_uint64_32 s 25 else get_uint64_32 s 21; ++ bloc = if usesixtyfour then String.sub s 29 (len-29) else String.sub s 25 (len-25) ++ } ++ ++ let print t = ++ lprintf_nl "EmuleCompressedPart for %s %Ld %Ld len %d" ++ (Md4.to_string t.md4) t.statpos t.newsize (String.length t.bloc) ++ ++ let write buf t = ++ buf_md4 buf t.md4; ++ if t.usesixtyfour then buf_int64 buf t.statpos else buf_int64_32 buf t.statpos; ++ buf_int64_32 buf t.newsize; ++ Buffer.add_string buf t.bloc ++ end + + module EmulePortTestReq = struct + +@@ -1115,7 +1138,7 @@ + | JoinQueueReq of JoinQueue.t (* sent before queryBloc *) + | AvailableSlotReq of AvailableSlot.t + | ReleaseSlotReq of ReleaseSlot.t +-| CloseSlotReq of CloseSlot.t ++| OutOfPartsReq of OutOfParts.t + | QueryChunksReq of QueryChunks.t + | QueryChunksReplyReq of QueryChunksReply.t + | QueryChunkMd4Req of QueryChunkMd4.t +@@ -1147,7 +1170,7 @@ + | EmuleSecIdentStateReq of EmuleSecIdentStateReq.t + | EmuleMultiPacketReq of Md4.t * t list + | EmuleMultiPacketAnswerReq of Md4.t * t list +-| EmuleCompressedPart of Md4.t * int64 * int64 * string ++| EmuleCompressedPart of EmuleCompressedPart.t + | EmulePortTestReq of EmulePortTestReq.t + + let rec print t = +@@ -1162,7 +1185,7 @@ + | JoinQueueReq t -> JoinQueue.print t + | AvailableSlotReq t -> AvailableSlot.print t + | ReleaseSlotReq t -> ReleaseSlot.print t +- | CloseSlotReq t -> CloseSlot.print t ++ | OutOfPartsReq t -> OutOfParts.print t + | QueryChunksReq t -> QueryChunks.print t + | QueryChunksReplyReq t -> QueryChunksReply.print t + | QueryChunkMd4Req t -> QueryChunkMd4.print t +@@ -1216,9 +1239,8 @@ + EmuleSignatureReq.print t + | EmulePublicKeyReq t -> + EmulePublicKeyReq.print t +- | EmuleCompressedPart (md4, statpos, newsize, bloc) -> +- lprintf_nl "EmuleCompressedPart for %s %Ld %Ld len %d" +- (Md4.to_string md4) statpos newsize (String.length bloc) ++ | EmuleCompressedPart t -> ++ EmuleCompressedPart.print t + | EmulePortTestReq t -> + EmulePortTestReq.print t + | UnknownReq (opcode, s) -> +@@ -1265,11 +1287,7 @@ + + | 0x40 (* 64 *) -> + (* OP_COMPRESSEDPART *) +- let md4 = get_md4 s 1 in +- let statpos = get_uint64_32 s 17 in +- let newsize = get_uint64_32 s 21 in +- let bloc = String.sub s 25 (len-25) in +- EmuleCompressedPart (md4, statpos, newsize, bloc) ++ EmuleCompressedPart (EmuleCompressedPart.parse false len s) + + | 0x85 (* 133 *) -> + EmulePublicKeyReq(EmulePublicKeyReq.parse len s) +@@ -1352,6 +1370,10 @@ + in + EmuleMultiPacketAnswerReq (md4, iter s 17 len) + ++ | 0xa1 (* 161 *) -> (* OP_COMPRESSEDPART_I64 *) ++ EmuleCompressedPart (EmuleCompressedPart.parse true len s) ++ | 0xa2 -> BlocReq (Bloc.parse true len s) (* OP_SENDINGPART_I64 *) ++ | 0xa3 -> QueryBlocReq (QueryBloc.parse true len s) (*OP_REQUESTPARTS_I64 *) + | 0xfe (* 254 *) -> + EmulePortTestReq s + +@@ -1377,8 +1399,8 @@ + begin + match opcode with + | 1 -> ConnectReq (Connect.parse false len s) +- | 70 -> BlocReq (Bloc.parse len s) +- | 71 -> QueryBlocReq (QueryBloc.parse len s) ++ | 70 -> BlocReq (Bloc.parse false len s) ++ | 71 -> QueryBlocReq (QueryBloc.parse false len s) + | 72 -> NoSuchFileReq (NoSuchFile.parse len s) + | 73 -> EndOfDownloadReq (EndOfDownload.parse len s) + | 74 -> ViewFilesReq (ViewFiles.parse len s) +@@ -1396,8 +1418,8 @@ + | 85 -> AvailableSlotReq (AvailableSlot.parse len s) + (* ReleaseSlot: the upload is finished *) + | 86 -> ReleaseSlotReq (ReleaseSlot.parse len s) +-(* CloseSlot: the upload slot is not available *) +- | 87 -> CloseSlotReq (CloseSlot.parse len s) ++(* OutOfParts: the upload slot is not available *) ++ | 87 -> OutOfPartsReq (OutOfParts.parse len s) + | 88 -> QueryFileReq (QueryFile.parse emule_version len s) + | 89 -> QueryFileReplyReq (QueryFileReply.parse len s) + | 92 -> QueueRankReq (QueueRank.parse len s) +@@ -1470,6 +1492,8 @@ + | EmuleQueueRankingReq _ + | EmuleCompressedPart _ + -> 0xC5 ++ | QueryBlocReq t when t.QueryBloc.usesixtyfour -> 0xC5 ++ | BlocReq t when t.Bloc.usesixtyfour -> 0xC5 + | _ + -> 227 + in +@@ -1491,10 +1515,10 @@ + buf_int8 buf 77; + OtherLocations.write buf t + | QueryBlocReq t -> +- buf_int8 buf 71; ++ buf_int8 buf (if t.QueryBloc.usesixtyfour then 0xa3 else 71); + QueryBloc.write buf t + | BlocReq t -> +- buf_int8 buf 70; ++ buf_int8 buf (if t.Bloc.usesixtyfour then 0xa2 else 70); + Bloc.write buf t + | JoinQueueReq t -> + buf_int8 buf 84; +@@ -1517,9 +1541,9 @@ + | ReleaseSlotReq t -> + buf_int8 buf 86; + ReleaseSlot.write buf t +- | CloseSlotReq t -> ++ | OutOfPartsReq t -> + buf_int8 buf 87; +- CloseSlot.write buf t ++ OutOfParts.write buf t + | ViewFilesReq t -> + buf_int8 buf 74; + ViewFiles.write buf t +@@ -1578,13 +1602,9 @@ + | EmuleFileDescReq t -> + buf_int8 buf 0x61; + EmuleFileDesc.write buf t +- | EmuleCompressedPart (md4, statpos, newsize, bloc) -> +- buf_int8 buf 0x40; +- buf_md4 buf md4; +- buf_int64_32 buf statpos; +- buf_int64_32 buf newsize; +- Buffer.add_string buf bloc +- ++ | EmuleCompressedPart t -> ++ buf_int8 buf (if t.EmuleCompressedPart.usesixtyfour then 0xa1 else 0x40); ++ EmuleCompressedPart.write buf t + | EmuleMultiPacketReq (md4, list) -> + buf_int8 buf 0x92; + buf_md4 buf md4; Index: src/networks/donkey/donkeyProtoCom.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoCom.ml,v retrieving revision 1.33 -retrieving revision 1.34 -diff -u -r1.33 -r1.34 +retrieving revision 1.36 +diff -u -r1.33 -r1.36 --- src/networks/donkey/donkeyProtoCom.ml 8 Oct 2006 14:20:22 -0000 1.33 -+++ src/networks/donkey/donkeyProtoCom.ml 2 Dec 2006 12:35:46 -0000 1.34 -@@ -339,8 +339,8 @@ ++++ src/networks/donkey/donkeyProtoCom.ml 8 Jan 2007 11:06:42 -0000 1.36 +@@ -79,14 +79,7 @@ + let client_send c m = + let emule_version = c.client_emule_proto in + if !verbose_msg_clients || c.client_debug then begin +- lprintf_nl "Sent to client[%d] %s(%s) %s" (client_num c) +- c.client_name (brand_to_string c.client_brand) +- (match c.client_kind with +- Indirect_address (server_ip, server_port, ip, port, real_ip) -> +- Printf.sprintf "[%s:%d]" (Ip.to_string (ip_of_id ip)) port +- | Direct_address (ip,port) -> Printf.sprintf "[%s:%d]" (Ip.to_string ip) port +- | Invalid_address _ -> "" +- ); ++ lprintf_nl "Sent to client %s" (full_client_identifier c); + DonkeyProtoClient.print m; + lprint_newline (); + end; +@@ -234,7 +227,8 @@ + if !verbose_share then lprintf_nl "tag_file: Sharing %s" name; + name + )):: +- (int64_tag Field_Size file.file_file.impl_file_size) :: ++ (int64_tag Field_Size_Hi (Int64.shift_right_logical file.file_file.impl_file_size 32)) :: ++ (int64_tag Field_Size (Int64.logand file.file_file.impl_file_size 0xffffffffL)) :: + ( + (match file.file_format with + FormatNotComputed next_time when +@@ -339,8 +333,8 @@ str_int s 0 nfiles; let s = String.sub s 0 prev_len in if !verbose_share || !verbose then @@ -6470,10 +10376,10 @@ Index: src/networks/donkey/donkeyProtoServer.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoServer.ml,v retrieving revision 1.23 -retrieving revision 1.25 -diff -u -r1.23 -r1.25 +retrieving revision 1.26 +diff -u -r1.23 -r1.26 --- src/networks/donkey/donkeyProtoServer.ml 26 Nov 2006 16:36:29 -0000 1.23 -+++ src/networks/donkey/donkeyProtoServer.ml 3 Dec 2006 20:49:42 -0000 1.25 ++++ src/networks/donkey/donkeyProtoServer.ml 6 Jan 2007 18:15:17 -0000 1.26 @@ -28,31 +28,6 @@ open DonkeyTypes open DonkeyMftp @@ -6545,6 +10451,21 @@ diff -u -r1.23 -r1.25 ] let rec parse_clients s pos nclients left = +@@ -833,7 +808,13 @@ + Printf.bprintf oc "QUERY LOCATION OF %s [%Ld]\n" (Md4.to_string t.md4) t.size + + let write buf t = +- buf_md4 buf t.md4; buf_int64_32 buf t.size ++ buf_md4 buf t.md4; ++ if t.size > old_max_emule_file_size then ++ begin ++ buf_int64_32 buf 0L; buf_int64 buf t.size ++ end ++ else ++ buf_int64_32 buf t.size + end + + module QueryLocationReply = struct Index: src/networks/donkey/donkeyProtoUdp.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoUdp.ml,v @@ -6637,10 +10558,10 @@ Index: src/networks/donkey/donkeyShare.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyShare.ml,v retrieving revision 1.55 -retrieving revision 1.56 -diff -u -r1.55 -r1.56 +retrieving revision 1.58 +diff -u -r1.55 -r1.58 --- src/networks/donkey/donkeyShare.ml 9 Oct 2006 16:17:19 -0000 1.55 -+++ src/networks/donkey/donkeyShare.ml 3 Dec 2006 20:57:56 -0000 1.56 ++++ src/networks/donkey/donkeyShare.ml 28 Jan 2007 20:26:46 -0000 1.58 @@ -44,12 +44,7 @@ | Some _ -> () | None -> @@ -6664,7 +10585,35 @@ diff -u -r1.55 -r1.56 impl_shared_servers = [] } in file.file_shared <- Some impl; -@@ -333,12 +328,6 @@ +@@ -189,12 +184,17 @@ + build a list of files_to_send with yet unpublished files *) + begin + let files_to_send = ref [] in ++ let can_publish f = not (file_is_largefile f && not s.server_has_largefiles) in + List.iter (fun f -> + match f.file_shared with + Some impl -> + if not (List.mem (CommonServer.as_server s.server_server) impl.impl_shared_servers) +- && List.length !files_to_send < !!max_published_files then ++ && List.length !files_to_send < !!max_published_files && can_publish f then + files_to_send := f :: !files_to_send ++ else ++ if not (can_publish f) then ++ lprintf_nl "Can not publish largefile %s because server %s does not support largefiles" ++ (file_best_name f) (string_of_server s) + | _ -> () (* this case never happens *) + ) all_shared; + +@@ -221,7 +221,7 @@ + + end + end +- ) (connected_servers ()); ++ ) (logged_in_servers ()); + + (* + The problem: sh.shared_fd might be closed during the execution of the +@@ -333,12 +333,6 @@ let found = ref false in List.iter (fun sh -> if sh.shared_name = fullname then found := true) !shared_files; if not !found then begin @@ -6677,7 +10626,7 @@ diff -u -r1.55 -r1.56 let rec impl = { impl_shared_update = 1; impl_shared_fullname = fullname; -@@ -350,7 +339,7 @@ +@@ -350,7 +344,7 @@ impl_shared_id = Md4.null; impl_shared_val = pre_shared; impl_shared_requests = 0; @@ -6718,13 +10667,16 @@ Index: src/networks/donkey/donkeyTypes.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyTypes.ml,v retrieving revision 1.52 -retrieving revision 1.54 -diff -u -r1.52 -r1.54 +retrieving revision 1.59 +diff -u -r1.52 -r1.59 --- src/networks/donkey/donkeyTypes.ml 26 Nov 2006 16:36:29 -0000 1.52 -+++ src/networks/donkey/donkeyTypes.ml 2 Dec 2006 12:35:46 -0000 1.54 -@@ -33,20 +33,32 @@ ++++ src/networks/donkey/donkeyTypes.ml 15 Jan 2007 21:32:56 -0000 1.59 +@@ -32,21 +32,37 @@ + let lprintf_n fmt = lprintf2 log_prefix fmt ++exception Donkey_large_file ++ type emule_proto = { - mutable emule_comments : int; mutable emule_version : int; @@ -6736,6 +10688,7 @@ diff -u -r1.52 -r1.54 + mutable emule_features : int; +(* emule_miscoptions1 *) ++ mutable received_miscoptions1 : bool; + mutable emule_aich : int; + mutable emule_unicode : int; + mutable emule_udpver : int; @@ -6753,6 +10706,7 @@ diff -u -r1.52 -r1.54 + mutable emule_supportpreview : int; + +(* emule_miscoptions2 *) ++ mutable received_miscoptions2 : bool; + mutable emule_require_crypt : int; + mutable emule_request_crypt : int; + mutable emule_support_crypt : int; @@ -6762,7 +10716,39 @@ diff -u -r1.52 -r1.54 } type emule_tag_name = -@@ -557,8 +569,10 @@ +@@ -69,15 +85,6 @@ + mutable nwarnings : int; + } + +-type client_score = +- Client_not_connected +-| Client_has_file +-| Client_has_priority_file +-| Client_has_chunk +-| Client_has_priority_chunk +-| Client_has_upload +-| Client_has_priority_upload +- + type reliability = + Reliability_neutral + | Reliability_reliable +@@ -100,6 +107,7 @@ + | Brand_emuleplus + | Brand_hydranode + | Brand_verycd ++| Brand_imp + + let brand_list = [ + ( Brand_unknown , "unknown" , "unk" ) ; +@@ -118,6 +126,7 @@ + ( Brand_emuleplus , "ePlus" , "eM+" ) ; + ( Brand_hydranode , "Hydra" , "Hyd" ) ; + ( Brand_verycd , "VeryCD" , "VCD" ) ; ++ ( Brand_imp , "IMPmule" , "IMP" ) ; + ] + + let brand_count = List.length brand_list +@@ -557,20 +566,19 @@ mutable client_checked : bool; mutable client_connected : bool; (* statistics *) @@ -6775,7 +10761,30 @@ diff -u -r1.52 -r1.54 mutable client_brand : brand; mutable client_brand_mod : brand_mod; mutable client_osinfo_sent : bool; -@@ -688,20 +702,32 @@ + mutable client_osinfo : string option; + mutable client_banned : bool; +- mutable client_score : int; +- mutable client_next_queue : int; + mutable client_rank : int; + mutable client_connect_time : int; + mutable client_requests_received : int; + mutable client_requests_sent: int; +- mutable client_indirect_address : (Ip.t * Ip.t * int) option; + mutable client_slot : slot_status; + mutable client_debug : bool; + mutable client_pending_messages: string list; +@@ -602,6 +610,10 @@ + mutable up_pos : int64; + mutable up_end_chunk : int64; + mutable up_chunks : (int64 * int64) list; ++ (* zones sent but not yet received by other peer, oldest first *) ++ mutable up_flying_chunks : (int64 * int64) list; ++ mutable up_current : int64; ++ mutable up_finish : bool; + mutable up_waiting : bool; + } + +@@ -688,21 +700,41 @@ CommonServer.server_state (as_server server.server_server) let dummy_emule_proto = { @@ -6789,6 +10798,7 @@ diff -u -r1.52 -r1.54 + emule_features = 0; +(* emule_miscoptions1 *) ++ received_miscoptions1 = false; + emule_aich = 0; + emule_unicode = 0; + emule_udpver = 0; @@ -6806,6 +10816,7 @@ diff -u -r1.52 -r1.54 + emule_supportpreview = 0; + +(* emule_miscoptions2 *) ++ received_miscoptions2 = false; + emule_require_crypt = 0; + emule_request_crypt = 0; + emule_support_crypt = 0; @@ -6815,6 +10826,13 @@ diff -u -r1.52 -r1.54 } let emule_proto () = + { dummy_emule_proto with emule_version = 0 } ++ ++let old_max_emule_file_size = 4290048000L ++(* #define OLD_MAX_EMULE_FILE_SIZE 4290048000ui64 // (4294967295/PARTSIZE)*PARTSIZE = ~4GB *) ++ ++let max_emule_file_size = 0x4000000000L ++(* #define MAX_EMULE_FILE_SIZE 0x4000000000ui64 // = 2^38 = 256GB *) Index: src/networks/donkey/donkeyUdp.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyUdp.ml,v @@ -6897,10 +10915,10 @@ Index: src/networks/fasttrack/fasttrackProto.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/fasttrack/fasttrackProto.ml,v retrieving revision 1.17 -retrieving revision 1.18 -diff -u -r1.17 -r1.18 +retrieving revision 1.19 +diff -u -r1.17 -r1.19 --- src/networks/fasttrack/fasttrackProto.ml 28 Aug 2006 18:19:16 -0000 1.17 -+++ src/networks/fasttrack/fasttrackProto.ml 3 Dec 2006 20:49:42 -0000 1.18 ++++ src/networks/fasttrack/fasttrackProto.ml 6 Jan 2007 18:15:17 -0000 1.19 @@ -108,30 +108,30 @@ let tag_of_tag tag s = @@ -6945,17 +10963,18 @@ diff -u -r1.17 -r1.18 let n1, pos = get_dynint s 0 in let n2, pos = get_dynint s pos in { tag_name = tag; tag_value = Pair (n1, n2) } -@@ -145,7 +145,8 @@ +@@ -145,7 +145,9 @@ | Field_Lastseencomplete | Field_Mediacodec | Field_Medialength - | Field_UNKNOWN _ -> ++ | Field_Size_Hi + | Field_UNKNOWN _ + | Field_KNOWN _ -> string_tag tag s -@@ -433,7 +434,7 @@ +@@ -433,7 +435,7 @@ let tags = if words <> "" then @@ -6964,7 +10983,7 @@ diff -u -r1.17 -r1.18 else tags in buf_int8 b (List.length tags); -@@ -458,7 +459,7 @@ +@@ -458,7 +460,7 @@ buf_int8 b ( try List.assoc tag name_of_tag with _ -> match tag with @@ -6973,7 +10992,7 @@ diff -u -r1.17 -r1.18 | _ -> assert false); buf_string b s; ) tags; -@@ -869,7 +870,7 @@ +@@ -869,7 +871,7 @@ let tag = try List2.assoc_inv tag name_of_tag with _ -> @@ -6982,7 +11001,7 @@ diff -u -r1.17 -r1.18 in iter_tags (pos + tag_len) (n-1) ((new_tag tag tagdata) :: tags) -@@ -916,7 +917,7 @@ +@@ -916,7 +918,7 @@ List2.assoc_inv tag name_of_tag with Not_found -> lprintf "WARNING Unknown tag %d\n" tag; @@ -6991,7 +11010,7 @@ diff -u -r1.17 -r1.18 in let v, pos = get_string m (pos+2) in let tag = tag_of_tag tag v in -@@ -1939,6 +1940,7 @@ +@@ -1939,6 +1941,7 @@ | Field_Artist | Field_Title | Field_Codec @@ -6999,7 +11018,14 @@ diff -u -r1.17 -r1.18 | Field_UNKNOWN _ | Field_Filename -> tags := (Substring, string_tag field w) :: !tags -@@ -1957,14 +1959,14 @@ +@@ -1951,20 +1954,21 @@ + | Field_Lastseencomplete + | Field_Mediacodec + | Field_Medialength ++ | Field_Size_Hi + | Field_Size -> () + end + | QHasMinVal (field, value) -> begin match field with | Field_Size @@ -7128,6 +11154,22 @@ diff -u -r1.52 -r1.53 ("", "sr", info.GuiTypes.file_name); ]); true ) +Index: src/networks/fileTP/fileTPOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/fileTP/fileTPOptions.ml,v +retrieving revision 1.11 +retrieving revision 1.12 +diff -u -r1.11 -r1.12 +--- src/networks/fileTP/fileTPOptions.ml 30 May 2006 10:54:14 -0000 1.11 ++++ src/networks/fileTP/fileTPOptions.ml 15 Jan 2007 18:26:27 -0000 1.12 +@@ -55,6 +55,7 @@ + string_option "range" + + let options_version = define_option fileTP_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + Index: src/networks/fileTP/fileTPSSH.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/fileTP/fileTPSSH.ml,v @@ -7196,6 +11238,59 @@ diff -u -r1.67 -r1.68 ("", "sr", info.GuiTypes.file_name); ]); true ) +Index: src/networks/gnutella/gnutellaOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/gnutella/gnutellaOptions.ml,v +retrieving revision 1.20 +retrieving revision 1.21 +diff -u -r1.20 -r1.21 +--- src/networks/gnutella/gnutellaOptions.ml 12 May 2006 21:02:38 -0000 1.20 ++++ src/networks/gnutella/gnutellaOptions.ml 15 Jan 2007 18:26:27 -0000 1.21 +@@ -37,6 +37,7 @@ + if !!max_ultrapeers > 10 then max_ultrapeers =:= 10) + + let client_port = define_option gnutella_section ["client_port"] ++ ~restart: true + "The port to bind the client to" + int_option GnutellaNetwork.port + +@@ -155,6 +156,7 @@ + string_option "" + + let options_version = define_option gnutella_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + +Index: src/networks/openFT/openFTOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/openFT/openFTOptions.ml,v +retrieving revision 1.4 +retrieving revision 1.5 +diff -u -r1.4 -r1.5 +--- src/networks/openFT/openFTOptions.ml 5 Nov 2005 16:23:41 -0000 1.4 ++++ src/networks/openFT/openFTOptions.ml 15 Jan 2007 18:26:27 -0000 1.5 +@@ -27,10 +27,12 @@ + int_option 5 + + let port = define_option openft_ini ["client_port"] ++ ~restart: true + "The port to bind the client to" + int_option 1215 + + let http_port = define_option openft_ini ["http_port"] ++ ~restart: true + "The port to bind the client to for downloads" + int_option 1216 + +@@ -43,6 +45,7 @@ + int_option 20 + + let options_version = define_option openft_ini ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + Index: src/networks/opennap/opennapInteractive.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/opennap/opennapInteractive.ml,v @@ -7222,6 +11317,30 @@ diff -u -r1.26 -r1.27 { t with S.bitrate = Some (Int64.to_int value, OP.AtBest) }; | Field_Size -> t | _ -> t +Index: src/networks/opennap/opennapOptions.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/networks/opennap/opennapOptions.ml,v +retrieving revision 1.11 +retrieving revision 1.12 +diff -u -r1.11 -r1.12 +--- src/networks/opennap/opennapOptions.ml 5 Nov 2005 16:23:41 -0000 1.11 ++++ src/networks/opennap/opennapOptions.ml 15 Jan 2007 18:26:27 -0000 1.12 +@@ -27,6 +27,7 @@ + let opennap_section = file_section opennap_ini ["Opennap"] "Opennap options" + + let client_port = define_option opennap_section ["client_port"] ++ ~restart: true + "The port to bind the client to" + int_option 6699 + +@@ -63,6 +64,7 @@ + int_option 400 + + let options_version = define_expert_option opennap_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + Index: src/networks/server/serverUdp.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/networks/server/serverUdp.ml,v @@ -7239,169 +11358,39 @@ diff -u -r1.2 -r1.3 s1.DonkeyTypes.server_last_message >= s2.DonkeyTypes.server_last_message ) !alive_servers in -Index: src/utils/cdk/sort2.ml +Index: src/networks/soulseek/slskOptions.ml =================================================================== -RCS file: src/utils/cdk/sort2.ml -diff -N src/utils/cdk/sort2.ml ---- src/utils/cdk/sort2.ml 22 Apr 2003 22:33:39 -0000 1.1 -+++ /dev/null 1 Jan 1970 00:00:00 -0000 -@@ -1,97 +0,0 @@ --(***********************************************************************) --(* *) --(* Objective Caml *) --(* *) --(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) --(* *) --(* Copyright 1996 Institut National de Recherche en Informatique et *) --(* en Automatique. All rights reserved. This file is distributed *) --(* under the terms of the GNU Library General Public License, with *) --(* the special exception on linking described in file ../LICENSE. *) --(* *) --(***********************************************************************) -- --(* Merging and sorting *) -- --open Array -- -- (* --let rec merge order l1 l2 = -- match l1 with -- [] -> l2 -- | h1 :: t1 -> -- match l2 with -- [] -> l1 -- | h2 :: t2 -> -- if order h1 h2 -- then h1 :: merge order t1 l2 -- else h2 :: merge order l1 t2 -- --let list order l = -- let rec initlist = function -- [] -> [] -- | [e] -> [[e]] -- | e1::e2::rest -> -- (if order e1 e2 then [e1;e2] else [e2;e1]) :: initlist rest in -- let rec merge2 = function -- l1::l2::rest -> merge order l1 l2 :: merge2 rest -- | x -> x in -- let rec mergeall = function -- [] -> [] -- | [l] -> l -- | llist -> mergeall (merge2 llist) in -- mergeall(initlist l) -- *) -- --let swap arr i j = -- let tmp = unsafe_get arr i in -- unsafe_set arr i (unsafe_get arr j); -- unsafe_set arr j tmp -- --let subarray cmp arr pos len = -- let rec qsort lo hi = -- if hi - lo >= 6 then begin -- let mid = (lo + hi) lsr 1 in -- (* Select median value from among LO, MID, and HI. Rearrange -- LO and HI so the three values are sorted. This lowers the -- probability of picking a pathological pivot. It also -- avoids extra comparisons on i and j in the two tight "while" -- loops below. *) -- if cmp (unsafe_get arr mid) (unsafe_get arr lo) <= 0 then swap arr mid lo; -- if cmp (unsafe_get arr hi) (unsafe_get arr mid) <= 0 then begin -- swap arr mid hi; -- if cmp (unsafe_get arr mid) (unsafe_get arr lo) <= 0 then swap arr mid lo -- end; -- let pivot = unsafe_get arr mid in -- let i = ref (lo + 1) and j = ref (hi - 1) in -- if not (cmp pivot (unsafe_get arr hi) <= 0) -- || not (cmp (unsafe_get arr lo) pivot <= 0) -- then raise (Invalid_argument "Sort.array"); -- while !i < !j do -- while not (cmp pivot (unsafe_get arr !i) <= 0) do incr i done; -- while not (cmp (unsafe_get arr !j) pivot <= 0) do decr j done; -- if !i < !j then swap arr !i !j; -- incr i; decr j -- done; -- (* Recursion on smaller half, tail-call on larger half *) -- if !j - lo <= hi - !i then begin -- qsort lo !j; qsort !i hi -- end else begin -- qsort !i hi; qsort lo !j -- end -- end in -- qsort pos (pos+len-1); -- (* Finish sorting by insertion sort *) -- for i = pos+1 to pos+len - 1 do -- let val_i = (unsafe_get arr i) in -- if not (cmp (unsafe_get arr (i - 1)) val_i <= 0) then begin -- unsafe_set arr i (unsafe_get arr (i - 1)); -- let j = ref (i - 1) in -- while !j >= 1 && not (cmp (unsafe_get arr (!j - 1)) val_i <= 0) do -- unsafe_set arr !j (unsafe_get arr (!j - 1)); -- decr j -- done; -- unsafe_set arr !j val_i -- end -- done -- -Index: src/utils/cdk/sort2.mli -=================================================================== -RCS file: src/utils/cdk/sort2.mli -diff -N src/utils/cdk/sort2.mli ---- src/utils/cdk/sort2.mli 22 Apr 2003 22:33:39 -0000 1.1 -+++ /dev/null 1 Jan 1970 00:00:00 -0000 -@@ -1,43 +0,0 @@ --(***********************************************************************) --(* *) --(* Objective Caml *) --(* *) --(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) --(* *) --(* Copyright 1996 Institut National de Recherche en Informatique et *) --(* en Automatique. All rights reserved. This file is distributed *) --(* under the terms of the GNU Library General Public License, with *) --(* the special exception on linking described in file ../LICENSE. *) --(* *) --(***********************************************************************) -- --(** Sorting and merging lists. -- -- @deprecated This module is obsolete and exists only for backward -- compatibility. -- The sorting functions in {!Array} and {!List} should be used instead. -- The new functions are faster and use less memory. --*) -- --(* --val list : ('a -> 'a -> bool) -> 'a list -> 'a list --(** Sort a list in increasing order according to an ordering predicate. -- The predicate should return [true] if its first argument is -- less than or equal to its second argument. *) --*) -- --val subarray : ('a -> 'a -> int) -> 'a array -> int -> int -> unit --(** Sort an array in increasing order according to an -- ordering predicate. -- The predicate should return [true] if its first argument is -- less than or equal to its second argument. -- The array is sorted in place. *) -- -- (* --val merge : ('a -> 'a -> bool) -> 'a list -> 'a list -> 'a list --(** Merge two lists according to the given predicate. -- Assuming the two argument lists are sorted according to the -- predicate, [merge] returns a sorted list containing the elements -- from the two lists. The behavior is undefined if the two -- argument lists were not sorted. *) --*) +RCS file: /sources/mldonkey/mldonkey/src/networks/soulseek/slskOptions.ml,v +retrieving revision 1.9 +retrieving revision 1.10 +diff -u -r1.9 -r1.10 +--- src/networks/soulseek/slskOptions.ml 5 Nov 2005 16:23:41 -0000 1.9 ++++ src/networks/soulseek/slskOptions.ml 15 Jan 2007 18:26:27 -0000 1.10 +@@ -46,6 +46,7 @@ + *) + + let slsk_port = define_option soulseek_section ["client_port"] ++ ~restart: true + "The port to bind the client to" + int_option 2234 + +@@ -74,6 +75,7 @@ + "the last token used for a query is saved here" int_option 1 + + let options_version = define_option soulseek_section ["options_version"] ++ ~internal: true + "(internal option)" + int_option 0 + Index: src/utils/cdk/string2.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/string2.ml,v retrieving revision 1.9 -retrieving revision 1.10 -diff -u -r1.9 -r1.10 +retrieving revision 1.11 +diff -u -r1.9 -r1.11 --- src/utils/cdk/string2.ml 20 Jul 2006 15:30:21 -0000 1.9 -+++ src/utils/cdk/string2.ml 3 Dec 2006 20:49:43 -0000 1.10 -@@ -322,3 +322,9 @@ ++++ src/utils/cdk/string2.ml 28 Jan 2007 20:39:59 -0000 1.11 +@@ -322,3 +322,19 @@ i >= l || p s.[i] && aux (i+1) in aux 0 @@ -7411,27 +11400,54 @@ diff -u -r1.9 -r1.10 + Printf.bprintf buf "%02x " (int_of_char c) + ) s; + Buffer.contents buf ++ ++let ( |> ) x f = f x ++ ++let dehtmlize = ++ let br_regexp = Str.regexp_case_fold "<br>" in ++ let tag_regexp = Str.regexp "<[^>]*>" in ++ fun s -> ++ s ++ |> Str.global_replace br_regexp "\n" ++ |> Str.global_replace tag_regexp "" Index: src/utils/cdk/string2.mli =================================================================== RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/string2.mli,v retrieving revision 1.10 -retrieving revision 1.11 -diff -u -r1.10 -r1.11 +retrieving revision 1.12 +diff -u -r1.10 -r1.12 --- src/utils/cdk/string2.mli 20 Jul 2006 15:30:21 -0000 1.10 -+++ src/utils/cdk/string2.mli 3 Dec 2006 20:49:43 -0000 1.11 -@@ -103,3 +103,4 @@ ++++ src/utils/cdk/string2.mli 28 Jan 2007 20:39:59 -0000 1.12 +@@ -103,3 +103,8 @@ val exists: (char -> bool) -> string -> bool val existsi: (int -> char -> bool) -> string -> bool val for_all: (char -> bool) -> string -> bool +val hex_string_of_string : string -> string ++ ++(* [dehtmlize s] replace all <br> with \n and remove all remaining html tags from string [s] *) ++val dehtmlize: string -> string ++ Index: src/utils/cdk/unix2.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/unix2.ml,v retrieving revision 1.31 -retrieving revision 1.32 -diff -u -r1.31 -r1.32 +retrieving revision 1.33 +diff -u -r1.31 -r1.33 --- src/utils/cdk/unix2.ml 12 Aug 2006 20:36:14 -0000 1.31 -+++ src/utils/cdk/unix2.ml 28 Nov 2006 23:52:17 -0000 1.32 ++++ src/utils/cdk/unix2.ml 6 Feb 2007 22:26:59 -0000 1.33 +@@ -78,10 +78,10 @@ + with End_of_file -> ()) + + let is_directory filename = +- try let s = Unix.stat filename in s.st_kind = S_DIR with _ -> false ++ try let s = Unix.LargeFile.stat filename in s.LargeFile.st_kind = S_DIR with _ -> false + + let is_link filename = +- try let s = Unix.lstat filename in s.st_kind = S_LNK with _ -> false ++ try let s = Unix.LargeFile.lstat filename in s.LargeFile.st_kind = S_LNK with _ -> false + + let chmod f o = + try @@ -89,7 +89,7 @@ with e -> lprintf_nl "warning: chmod failed on %s: %s" f (Printexc2.to_string e) @@ -7454,24 +11470,340 @@ diff -u -r1.31 -r1.32 let copy oldname newname = tryopen_read_bin oldname (fun ic -> -+ let stats = Unix.fstat (Unix.descr_of_in_channel ic) in ++ let stats = Unix.LargeFile.fstat (Unix.descr_of_in_channel ic) in tryopen_write_bin newname (fun oc -> + let descr = Unix.descr_of_out_channel oc in -+ (try Unix.fchown descr stats.Unix.st_uid stats.Unix.st_gid ++ (try Unix.fchown descr stats.Unix.LargeFile.st_uid stats.Unix.LargeFile.st_gid + with e -> lprintf_nl "copy: failed to preserve owner"); -+ (try Unix.fchmod descr stats.Unix.st_perm ++ (try Unix.fchmod descr stats.Unix.LargeFile.st_perm + with e -> lprintf_nl "copy: failed to preserve mode"); let buffer_len = 8192 in let buffer = String.create buffer_len in let rec copy_file () = +Index: src/utils/cdk/zip.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/zip.ml,v +retrieving revision 1.7 +retrieving revision 1.8 +diff -u -r1.7 -r1.8 +--- src/utils/cdk/zip.ml 20 Jul 2006 11:33:58 -0000 1.7 ++++ src/utils/cdk/zip.ml 6 Feb 2007 22:26:59 -0000 1.8 +@@ -10,7 +10,7 @@ + (* *) + (***********************************************************************) + +-(* $Id: zip.ml,v 1.7 2006/07/20 11:33:58 spiralvoice Exp $ *) ++(* $Id: zip.ml,v 1.8 2007/02/06 22:26:59 spiralvoice Exp $ *) + + (* Module [Zip]: reading and writing ZIP archives *) + +@@ -544,7 +544,7 @@ + match mtime with + Some t -> mtime + | None -> +- try Some((Unix.stat infilename).Unix.st_mtime) ++ try Some((Unix.LargeFile.stat infilename).Unix.LargeFile.st_mtime) + with Unix.Unix_error(_,_,_) -> None in + try + copy_channel_to_entry ic ofile ~extra ~comment ~level ?mtime:mtime' name; +Index: src/utils/lib/misc.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/lib/misc.ml,v +retrieving revision 1.7 +retrieving revision 1.8 +diff -u -r1.7 -r1.8 +--- src/utils/lib/misc.ml 25 Oct 2006 11:12:38 -0000 1.7 ++++ src/utils/lib/misc.ml 6 Feb 2007 22:26:59 -0000 1.8 +@@ -67,12 +67,13 @@ + List.iter (zip_extract_entry ic) (Zip.entries ic)) + + let rec zip_add_entry oc file = +- let s = Unix.stat file in +- match s.Unix.st_kind with ++ let module U = Unix.LargeFile in ++ let s = U.stat file in ++ match s.U.st_kind with + Unix.S_REG -> +- Zip.copy_file_to_entry file oc ~mtime:s.Unix.st_mtime file ++ Zip.copy_file_to_entry file oc ~mtime:s.U.st_mtime file + | Unix.S_DIR -> +- Zip.add_entry "" oc ~mtime:s.Unix.st_mtime ++ Zip.add_entry "" oc ~mtime:s.U.st_mtime + (if Filename.check_suffix file "/" then file else file ^ "/"); + Unix2.tryopen_dir file (fun d -> + try +Index: src/utils/lib/options.ml4 +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.ml4,v +retrieving revision 1.22 +retrieving revision 1.23 +diff -u -r1.22 -r1.23 +--- src/utils/lib/options.ml4 21 Oct 2006 19:35:54 -0000 1.22 ++++ src/utils/lib/options.ml4 15 Jan 2007 18:26:27 -0000 1.23 +@@ -61,6 +61,9 @@ + mutable option_hooks : (unit -> unit) list; + option_section : options_section; + option_advanced : bool; ++ option_restart : bool; ++ option_public : bool; ++ option_internal : bool; + } + and options_file = + { mutable file_name : string; +@@ -137,6 +140,7 @@ + + let define_simple_option + normalp (section : options_section) (option_name : string list) desc ++ restart public internal + (option_help : string) (option_class : 'a option_class) + (default_value : 'a) (advanced : bool) = + let desc = match desc with None -> "" | Some s -> s in +@@ -145,6 +149,9 @@ + option_class = option_class; option_value = default_value; + option_default = default_value; + option_hooks = []; option_section = section; ++ option_restart = (match restart with None -> false | Some v -> v); ++ option_public = (match public with None -> false | Some v -> v); ++ option_internal = (match internal with None -> false | Some v -> v); + option_advanced = advanced; option_desc = desc; } + in + section.section_options <- +@@ -168,16 +175,16 @@ + let define_header_option + opfile option_name option_help option_class default_value = + define_simple_option false (List.hd opfile.file_sections) +- option_name None option_help option_class ++ option_name None None None None option_help option_class + default_value false + +-let define_option opfile option_name ?desc option_help option_class default_value = +- define_simple_option true opfile option_name desc option_help option_class ++let define_option opfile option_name ?desc ?restart ?public ?internal option_help option_class default_value = ++ define_simple_option true opfile option_name desc restart public internal option_help option_class + default_value false + + let define_expert_option +- opfile option_name ?desc option_help option_class default_value = +- define_simple_option true opfile option_name desc option_help option_class ++ opfile option_name ?desc ?restart ?public ?internal option_help option_class default_value = ++ define_simple_option true opfile option_name desc restart public internal option_help option_class + default_value true + + +@@ -379,12 +386,16 @@ + let rec save_module indent oc list = + let subm = ref [] in + List.iter +- (fun (name, help, value) -> ++ (fun (name, help, restart, internal, value) -> + match name with + [] -> assert false + | [name] -> + if !with_help && help <> "" then + Printf.fprintf oc "\n\t(* %s *)\n" (tabulate help); ++ if restart then ++ Printf.fprintf oc "\t(* changing this option requires restart of MLDonkey core *)\n"; ++ if internal then ++ Printf.fprintf oc "\t(* Do not change this option, internal use only! *)\n"; + Printf.fprintf oc "%s %s = " indent (safe_string name); + save_value indent oc value; + Printf.fprintf oc "\n" +@@ -393,7 +404,7 @@ + try List.assoc m !subm with + e -> let p = ref [] in subm := (m, p) :: !subm; p + in +- p := (tail, help, value) :: !p) ++ p := (tail, help, restart, internal, value) :: !p) + list; + List.iter + (fun (m, p) -> +@@ -804,6 +815,7 @@ + + let option_to_value o = + o.option_name, o.option_help, ++ o.option_restart, o.option_internal, + (try o.option_class.to_value o.option_value with + e -> + lprintf "Error while saving option \"%s\": %s\n" +@@ -1045,29 +1057,6 @@ + let help = o.option_help in if help = "" then "No Help Available" else help + let advanced o = o.option_advanced + +-(* +-let simple_options opfile = +- let list = ref [] in +- List.iter (fun s -> +- List.iter +- (fun o -> +- match o.option_name with +- [] | _ :: _ :: _ -> () +- | [name] -> +- match o.option_class.to_value o.option_value with +- Module _ | SmallList _ | List _ | DelayedValue _ -> +- begin match o.option_class.string_wrappers with +- None -> () +- | Some (to_string, from_string) -> +- list := (name, to_string o.option_value) :: !list +- end +- | v -> list := (name, safe_value_to_string v) :: !list) +- s.section_options) +- opfile.file_sections; +- !list +-*) +- +- + let get_option opfile name = + (* lprintf "get_option [%s]\n" name;*) + let rec iter name list sections = +@@ -1140,6 +1129,9 @@ + option_advanced : bool; + option_default : string; + option_type : string; ++ option_restart : bool; ++ option_public : bool; ++ option_internal : bool; + } + + end +@@ -1173,13 +1165,17 @@ + M.option_advanced = o.option_advanced; + M.option_help = o.option_help; + M.option_type = o.option_class.class_name; ++ M.option_restart = o.option_restart; ++ M.option_public = o.option_public; ++ M.option_internal = o.option_internal; + } + +-let simple_options prefix opfile = ++let simple_options prefix opfile admin = + let list = ref [] in + List.iter (fun s -> + List.iter + (fun o -> ++ if admin || o.option_public then + try list := strings_of_option prefix o :: !list with _ -> ()) + s.section_options) + opfile.file_sections; +@@ -1195,7 +1191,7 @@ + set_simple_option opfile oi.M.option_name s), + Printf.sprintf "<string> : \t%s (current: %s)" + oi.M.option_help oi.M.option_value) +- (simple_options prefix opfile) ++ (simple_options prefix opfile true) + + let prefixed_args prefix file = + List.map +@@ -1224,6 +1220,9 @@ + option_advanced : bool; + option_default : string; + option_type : string; ++ option_restart : bool; ++ option_public : bool; ++ option_internal : bool; + } + + let iter_section f s = +Index: src/utils/lib/options.mli +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.mli,v +retrieving revision 1.10 +retrieving revision 1.11 +diff -u -r1.10 -r1.11 +--- src/utils/lib/options.mli 21 Oct 2006 19:35:54 -0000 1.10 ++++ src/utils/lib/options.mli 15 Jan 2007 18:26:27 -0000 1.11 +@@ -43,6 +43,9 @@ + option_advanced : bool; + option_default : string; + option_type : string; ++ option_restart : bool; (* changing this option requires a restart *) ++ option_public : bool; (* send this option to GUIs even for non-admin users *) ++ option_internal : bool; (* this option should not be changed by users *) + } + + exception SideEffectOption +@@ -77,9 +80,11 @@ + (*4 Creating options *) + val define_option : options_section -> + string list -> ?desc: string -> ++ ?restart: bool -> ?public: bool -> ?internal: bool -> + string -> 'a option_class -> 'a -> 'a option_record + val define_expert_option : options_section -> + string list -> ?desc: string -> ++ ?restart: bool -> ?public: bool -> ?internal: bool -> + string -> 'a option_class -> 'a -> 'a option_record + val define_header_option : options_file -> + string list -> string -> 'a option_class -> 'a -> 'a option_record +@@ -183,7 +188,7 @@ + val value_to_filename : option_value -> string + + val set_simple_option : options_file -> string -> string -> unit +-val simple_options : string -> options_file -> option_info list ++val simple_options : string -> options_file -> bool -> option_info list + val get_simple_option : options_file -> string -> string + val set_option_hook : options_file -> string -> (unit -> unit) -> unit + +Index: src/utils/lib/os_stubs.h +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/lib/os_stubs.h,v +retrieving revision 1.16 +retrieving revision 1.17 +diff -u -r1.16 -r1.17 +--- src/utils/lib/os_stubs.h 5 Sep 2006 14:19:10 -0000 1.16 ++++ src/utils/lib/os_stubs.h 8 Jan 2007 11:02:08 -0000 1.17 +@@ -34,6 +34,7 @@ + typedef SOCKET OS_SOCKET;
+ typedef unsigned int uint;
+ extern void win32_maperr(unsigned long errcode);
++unsigned char * utf8_to_utf16(const char * str);
+
+ /*******************************************************************
+
+Index: src/utils/lib/stubs_c.c +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/lib/stubs_c.c,v +retrieving revision 1.42 +retrieving revision 1.43 +diff -u -r1.42 -r1.43 +--- src/utils/lib/stubs_c.c 15 Aug 2006 11:32:51 -0000 1.42 ++++ src/utils/lib/stubs_c.c 8 Jan 2007 11:02:08 -0000 1.43 +@@ -954,7 +954,7 @@ + FARPROC f; + int retval = 0; + WCHAR tmp [MAX_PATH], resolved_path [MAX_PATH]; +- WCHAR * wpath=utf8_to_utf16(path); ++ WCHAR * wpath = (WCHAR *)utf8_to_utf16(path); + realpath(wpath, resolved_path); + free(wpath); + if (!resolved_path) +Index: src/utils/lib/syslog.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/lib/syslog.ml,v +retrieving revision 1.2 +retrieving revision 1.3 +diff -u -r1.2 -r1.3 +--- src/utils/lib/syslog.ml 24 Jul 2006 20:15:16 -0000 1.2 ++++ src/utils/lib/syslog.ml 6 Feb 2007 22:26:59 -0000 1.3 +@@ -124,10 +124,11 @@ + } + + let open_connection loginfo = ++ let module U = Unix.LargeFile in + match loginfo.logpath with + "" -> raise (Syslog_error "unable to find the syslog socket or pipe, is syslogd running?") + | logpath -> +- (match (Unix.stat logpath).Unix.st_kind with ++ (match (U.stat logpath).U.st_kind with + Unix.S_SOCK -> + let logaddr = Unix.ADDR_UNIX logpath in + (try Index: src/utils/lib/unix32.ml =================================================================== RCS file: /sources/mldonkey/mldonkey/src/utils/lib/unix32.ml,v retrieving revision 1.65 -retrieving revision 1.66 -diff -u -r1.65 -r1.66 +retrieving revision 1.67 +diff -u -r1.65 -r1.67 --- src/utils/lib/unix32.ml 15 Jul 2006 11:52:54 -0000 1.65 -+++ src/utils/lib/unix32.ml 28 Nov 2006 23:52:18 -0000 1.66 ++++ src/utils/lib/unix32.ml 6 Feb 2007 22:26:59 -0000 1.67 @@ -31,15 +31,14 @@ let max_buffered = ref (Int64.of_int (1024 * 1024)) @@ -7500,6 +11832,19 @@ diff -u -r1.65 -r1.66 else Unix.openfile t.filename ro_flag 0o400 with e -> +@@ -206,9 +206,9 @@ + let owner t = + try + check_destroyed t; +- let s = Unix.fstat (local_force_fd t) in +- let user = Unix.getpwuid s.Unix.st_uid in +- let group = Unix.getgrgid s.Unix.st_gid in ++ let s = Unix.LargeFile.fstat (local_force_fd t) in ++ let user = Unix.getpwuid s.Unix.LargeFile.st_uid in ++ let group = Unix.getgrgid s.Unix.LargeFile.st_gid in + user.Unix.pw_name, group.Unix.gr_name + with e -> + if !verbose then lprintf_nl "Exception in FDCache.owner %s: %s" @@ -254,9 +254,9 @@ check_destroyed t; close t; @@ -7531,3 +11876,26 @@ diff -u -r1.23 -r1.24 val close : t -> unit (* val force_fd : t -> Unix.file_descr *) +Index: src/utils/net/http_client.ml +=================================================================== +RCS file: /sources/mldonkey/mldonkey/src/utils/net/http_client.ml,v +retrieving revision 1.35 +retrieving revision 1.36 +diff -u -r1.35 -r1.36 +--- src/utils/net/http_client.ml 21 Nov 2006 22:34:34 -0000 1.35 ++++ src/utils/net/http_client.ml 4 Feb 2007 17:27:45 -0000 1.36 +@@ -334,6 +334,14 @@ + raise Not_found + end + ++ | 400 when r.req_request = HEAD -> ++ lprintf_nl "Error 400 received for HEAD %s, re-try GET" (Url.to_string_no_args r.req_url); ++ let r2 = { ++ r with ++ req_request = GET; ++ } in ++ get_page r2 content_handler f ferr ++ + | 404 -> + lprintf_nl "404: Not found for: %s" (Url.to_string_no_args r.req_url); + close sock (Closed_for_error "bad reply"); |