24 |
open TcpBufferedSocket |
open TcpBufferedSocket |
25 |
open Options |
open Options |
26 |
open Unix |
open Unix |
27 |
|
|
28 |
|
|
29 |
let bin_dir = Filename.dirname Sys.argv.(0) |
let bin_dir = Filename.dirname Sys.argv.(0) |
30 |
|
|
31 |
let home_dir = (try Sys.getenv "HOME" with _ -> ".") |
let home_dir = (try Sys.getenv "HOME" with _ -> ".") |
113 |
|
|
114 |
|
|
115 |
let _s x = _s "CommonOptions" x |
let _s x = _s "CommonOptions" x |
116 |
let _b x = _b "CommonOptions" x |
let _b x = _b "CommonOptions" x |
117 |
|
|
118 |
let define_option a b ?desc c d e = |
let define_option a b ?desc c d e = |
119 |
match desc with |
match desc with |
120 |
None -> define_option a b (_s c) d e |
None -> define_option a b (_s c) d e |
121 |
| Some desc -> define_option a b ~desc: (_s desc) (_s c) d e |
| Some desc -> define_option a b ~desc: (_s desc) (_s c) d e |
122 |
let define_expert_option a b ?desc c d e = |
let define_expert_option a b ?desc c d e = |
123 |
match desc with |
match desc with |
124 |
None -> define_expert_option a b (_s c) d e |
None -> define_expert_option a b (_s c) d e |
125 |
| Some desc -> define_expert_option a b ~desc: (_s desc) (_s c) d e |
| Some desc -> define_expert_option a b ~desc: (_s desc) (_s c) d e |
170 |
| StringValue "false" -> 0 |
| StringValue "false" -> 0 |
171 |
| _ -> value_to_int v) |
| _ -> value_to_int v) |
172 |
int_to_value |
int_to_value |
173 |
|
|
174 |
let addr_option = define_option_class "Addr" |
let addr_option = define_option_class "Addr" |
175 |
(fun value -> |
(fun value -> |
176 |
let s = value_to_string value in |
let s = value_to_string value in |
177 |
let addr, port = String2.cut_at s ':' in |
let addr, port = String2.cut_at s ':' in |
179 |
(fun (addr, port) -> string_to_value (Printf.sprintf "%s:%d" addr port)) |
(fun (addr, port) -> string_to_value (Printf.sprintf "%s:%d" addr port)) |
180 |
|
|
181 |
let _ = |
let _ = |
182 |
Options.set_string_wrappers ip_list_option |
Options.set_string_wrappers ip_list_option |
183 |
(fun list -> |
(fun list -> |
184 |
List.fold_left (fun s ip -> |
List.fold_left (fun s ip -> |
185 |
Printf.sprintf "%s %s" (Ip.to_string ip) s |
Printf.sprintf "%s %s" (Ip.to_string ip) s |
189 |
let list = String2.tokens s in |
let list = String2.tokens s in |
190 |
List.map (fun ip -> Ip.of_string ip) list |
List.map (fun ip -> Ip.of_string ip) list |
191 |
) |
) |
192 |
|
|
193 |
let is_not_spam = ref (fun _ -> true) |
let is_not_spam = ref (fun _ -> true) |
|
|
|
|
(****************** |
|
194 |
|
|
|
BASIC OPTIONS |
|
195 |
|
|
|
********************) |
|
196 |
|
|
197 |
|
|
198 |
|
(*************************************************************************) |
199 |
|
(* *) |
200 |
|
(* BASIC OPTIONS *) |
201 |
|
(* *) |
202 |
|
(*************************************************************************) |
203 |
|
|
204 |
let _ = Random.self_init () |
let _ = Random.self_init () |
205 |
|
|
206 |
let random_letter () = |
let random_letter () = |
208 |
|
|
209 |
let new_name () = |
let new_name () = |
210 |
(Printf.sprintf "%c%c%c%c%c%c" |
(Printf.sprintf "%c%c%c%c%c%c" |
211 |
(random_letter ()) (random_letter ()) (random_letter ()) |
(random_letter ()) (random_letter ()) (random_letter ()) |
212 |
(random_letter ()) (random_letter ()) (random_letter ())) |
(random_letter ()) (random_letter ()) (random_letter ())) |
213 |
|
|
214 |
|
|
215 |
let main_section = file_section downloads_ini ["Main"] |
let main_section = file_section downloads_ini ["Main"] |
216 |
"Main options" |
"Main options" |
217 |
let interfaces_section = file_section downloads_ini ["Interfaces" ] |
let interfaces_section = file_section downloads_ini ["Interfaces"] |
218 |
"Options to control ports used by mldonkey interfaces" |
"Options to control ports used by mldonkey interfaces" |
219 |
let bandwidth_section = file_section downloads_ini ["Bandwidth"] |
let bandwidth_section = file_section downloads_ini ["Bandwidth"] |
220 |
"" |
"" |
224 |
"Network config options" |
"Network config options" |
225 |
let html_section = file_section downloads_ini ["HTML mods"] |
let html_section = file_section downloads_ini ["HTML mods"] |
226 |
"Options to configure HTML mode" |
"Options to configure HTML mode" |
227 |
let debug_section = file_section downloads_ini ["Debug"] |
let debug_section = file_section downloads_ini ["Debug"] |
228 |
"Debug options" |
"Debug options" |
229 |
let download_section = file_section downloads_ini ["Download"] |
let download_section = file_section downloads_ini ["Download"] |
230 |
"Download options" |
"Download options" |
231 |
let startup_section = file_section downloads_ini ["Startup"] |
let startup_section = file_section downloads_ini ["Startup"] |
232 |
"Startup options" |
"Startup options" |
233 |
let mail_section = file_section downloads_ini ["Mail"] |
let mail_section = file_section downloads_ini ["Mail"] |
234 |
"Mail options" |
"Mail options" |
235 |
let path_section = file_section downloads_ini ["Paths"] |
let path_section = file_section downloads_ini ["Paths"] |
236 |
"Paths options" |
"Paths options" |
237 |
let mlchat_section = file_section downloads_ini ["MLChat"] |
let mlchat_section = file_section downloads_ini ["MLChat"] |
238 |
"MLChat options" |
"MLChat options" |
239 |
let security_section = file_section downloads_ini ["Security"] |
let security_section = file_section downloads_ini ["Security"] |
240 |
"Security options" |
"Security options" |
241 |
let other_section = file_section downloads_ini ["Other"] |
let other_section = file_section downloads_ini ["Other"] |
242 |
"Other options" |
"Other options" |
243 |
|
|
244 |
|
|
245 |
|
|
|
|
|
|
|
|
|
|
|
246 |
|
|
247 |
(*************************************************************************) |
(*************************************************************************) |
248 |
(* *) |
(* *) |
249 |
(* Main section *) |
(* Main section *) |
250 |
(* *) |
(* *) |
251 |
(*************************************************************************) |
(*************************************************************************) |
252 |
|
|
|
|
|
|
|
|
|
|
|
253 |
let current_section = main_section |
let current_section = main_section |
254 |
|
|
255 |
let global_login = define_option current_section ["client_name"] |
let global_login = define_option current_section ["client_name"] |
256 |
"small name of client" string_option (new_name ()) |
"small name of client" string_option (new_name ()) |
257 |
|
|
258 |
|
|
259 |
|
|
|
|
|
|
|
|
|
|
|
260 |
|
|
261 |
(*************************************************************************) |
(*************************************************************************) |
262 |
(* *) |
(* *) |
263 |
(* Interfaces section *) |
(* Interfaces section *) |
264 |
(* *) |
(* *) |
265 |
(*************************************************************************) |
(*************************************************************************) |
266 |
|
|
|
|
|
|
|
|
267 |
let current_section = interfaces_section |
let current_section = interfaces_section |
268 |
|
|
269 |
let allowed_ips = define_option current_section ["allowed_ips"] |
let allowed_ips = define_option current_section ["allowed_ips"] |
273 |
example for internal command: set allowed_ips \"127.0.0.1 192.168.1.2\" |
example for internal command: set allowed_ips \"127.0.0.1 192.168.1.2\" |
274 |
or for editing the ini-file: allowed_ips = [ \"127.0.0.1\"; \"192.168.1.2\";] |
or for editing the ini-file: allowed_ips = [ \"127.0.0.1\"; \"192.168.1.2\";] |
275 |
wildcard=255 ie: use 192.168.0.255 for 192.168.0.*" |
wildcard=255 ie: use 192.168.0.255 for 192.168.0.*" |
276 |
ip_list_option [Ip.localhost] |
ip_list_option [Ip.localhost] |
277 |
|
|
278 |
let gui_port = |
let gui_port = |
279 |
define_option current_section ["gui_port"] |
define_option current_section ["gui_port"] |
280 |
~desc: "The port to connect the GUI" |
~desc: "The port to connect the GUI" |
281 |
"port for Graphical Interfaces" int_option 4001 |
"port for Graphical Interfaces" int_option 4001 |
282 |
|
|
283 |
let gift_port = |
let gift_port = |
284 |
define_option current_section ["gift_port"] |
define_option current_section ["gift_port"] |
285 |
~desc: "The port to connect for GiFT GUIs." |
~desc: "The port to connect for GiFT GUIs." |
286 |
"port for GiFT Graphical Interfaces interaction. It was 1213, but the default is |
"port for GiFT Graphical Interfaces interaction. It was 1213, but the default is |
287 |
now 0 for disabled, because it does not check for a password." int_option 0 |
now 0 for disabled, because it does not check for a password." int_option 0 |
288 |
|
|
289 |
let http_port = |
let http_port = |
290 |
define_option current_section ["http_port"] |
define_option current_section ["http_port"] |
291 |
~desc: "The port to connect via HTTP" |
~desc: "The port to connect via HTTP" |
292 |
"The port used to connect to your client with a WEB browser" int_option 4080 |
"The port used to connect to your client with a WEB browser" int_option 4080 |
293 |
|
|
294 |
let telnet_port = define_option current_section ["telnet_port"] |
let telnet_port = define_option current_section ["telnet_port"] |
295 |
~desc: "The port to connect via telnet" |
~desc: "The port to connect via telnet" |
296 |
"port for user interaction" int_option 4000 |
"port for user interaction" int_option 4000 |
297 |
|
|
298 |
let http_bind_addr = define_expert_option current_section ["http_bind_addr"] |
let http_bind_addr = define_expert_option current_section ["http_bind_addr"] |
299 |
"The IP address used to bind the http server" |
"The IP address used to bind the http server" |
300 |
Ip.option (Ip.any) |
Ip.option (Ip.any) |
301 |
|
|
302 |
let gui_bind_addr = define_expert_option current_section ["gui_bind_addr"] |
let gui_bind_addr = define_expert_option current_section ["gui_bind_addr"] |
303 |
"The IP address used to bind the gui server" |
"The IP address used to bind the gui server" |
304 |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
305 |
|
|
306 |
let telnet_bind_addr = define_expert_option current_section ["telnet_bind_addr"] |
let telnet_bind_addr = define_expert_option current_section ["telnet_bind_addr"] |
307 |
"The IP address used to bind the telnet server" |
"The IP address used to bind the telnet server" |
308 |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
313 |
let improved_telnet = |
let improved_telnet = |
314 |
define_expert_option current_section ["improved_telnet"] "Improved telnet interface" bool_option true |
define_expert_option current_section ["improved_telnet"] "Improved telnet interface" bool_option true |
315 |
|
|
316 |
let alias_commands = |
let alias_commands = |
317 |
define_option current_section ["alias_commands"] |
define_option current_section ["alias_commands"] |
318 |
"Aliases to commands. The alias (fist string) has to be |
"Aliases to commands. The alias (fist string) has to be |
319 |
whitespaceless, the outcome of the alias (second string) |
whitespaceless, the outcome of the alias (second string) |
320 |
may have spaces (put it in quotation then)." |
may have spaces (put it in quotation then)." |
323 |
"exit", "q"; |
"exit", "q"; |
324 |
] |
] |
325 |
|
|
326 |
|
|
327 |
|
|
328 |
|
|
329 |
(*************************************************************************) |
(*************************************************************************) |
330 |
(* *) |
(* *) |
331 |
(* Bandwidth section *) |
(* Bandwidth section *) |
332 |
(* *) |
(* *) |
333 |
(*************************************************************************) |
(*************************************************************************) |
334 |
|
|
335 |
let current_section = bandwidth_section |
let current_section = bandwidth_section |
336 |
|
|
337 |
let max_hard_upload_rate = define_option current_section ["max_hard_upload_rate"] |
let max_hard_upload_rate = define_option current_section ["max_hard_upload_rate"] |
338 |
"The maximal upload rate you can tolerate on your link in kBytes/s (0 = no limit) |
"The maximal upload rate you can tolerate on your link in kBytes/s (0 = no limit) |
339 |
The limit will apply on all your connections (clients and servers) and both |
The limit will apply on all your connections (clients and servers) and both |
340 |
control and data messages." int_option 7 |
control and data messages." int_option 7 |
341 |
|
|
342 |
let max_hard_download_rate = define_option current_section ["max_hard_download_rate"] |
let max_hard_download_rate = define_option current_section ["max_hard_download_rate"] |
343 |
"The maximal download rate you can tolerate on your link in kBytes/s (0 = no limit) |
"The maximal download rate you can tolerate on your link in kBytes/s (0 = no limit) |
344 |
The limit will apply on all your connections (clients and servers) and both |
The limit will apply on all your connections (clients and servers) and both |
345 |
control and data messages." int_option 50 |
control and data messages." int_option 50 |
346 |
|
|
347 |
|
|
348 |
let max_opened_connections = define_option current_section |
let max_opened_connections = define_option current_section |
349 |
["max_opened_connections"] "Maximal number of opened connections" |
["max_opened_connections"] "Maximal number of opened connections" |
350 |
int_option (min MlUnix.max_sockets 200) |
int_option (min MlUnix.max_sockets 200) |
351 |
|
|
352 |
|
|
354 |
"How many slots can be used for upload" |
"How many slots can be used for upload" |
355 |
int_option 5 |
int_option 5 |
356 |
|
|
357 |
let dynamic_slots = define_option current_section ["dynamic_slots"] |
let dynamic_slots = define_option current_section ["dynamic_slots"] |
358 |
"Set this to true if you want to have dynamic upload slot allocation (experimental)" bool_option false |
"Set this to true if you want to have dynamic upload slot allocation (experimental)" bool_option false |
359 |
|
|
360 |
let max_connections_per_second = define_option current_section |
let max_connections_per_second = define_option current_section |
363 |
int_option 5 |
int_option 5 |
364 |
|
|
365 |
let loop_delay = define_expert_option current_section |
let loop_delay = define_expert_option current_section |
366 |
["loop_delay"] |
["loop_delay"] |
367 |
"The delay in milliseconds to wait in the event loop. Can be decreased to |
"The delay in milliseconds to wait in the event loop. Can be decreased to |
368 |
increase the bandwidth usage, or increased to lower the CPU usage." |
increase the bandwidth usage, or increased to lower the CPU usage." |
369 |
int_option 5 |
int_option 5 |
370 |
|
|
371 |
let nolimit_ips = define_option current_section ["nolimit_ips"] |
let nolimit_ips = define_option current_section ["nolimit_ips"] |
372 |
~desc: "No-limit IPs" |
~desc: "No-limit IPs" |
373 |
"list of IP addresses allowed to connect to the core with no limit on |
"list of IP addresses allowed to connect to the core with no limit on |
374 |
upload/download and upload slots. List separated by spaces, wildcard=255 |
upload/download and upload slots. List separated by spaces, wildcard=255 |
375 |
ie: use 192.168.0.255 for 192.168.0.* " |
ie: use 192.168.0.255 for 192.168.0.* " |
376 |
ip_list_option [Ip.localhost] |
ip_list_option [Ip.localhost] |
377 |
|
|
381 |
from a channel, but use more CPU as it must then copy the data in the |
from a channel, but use more CPU as it must then copy the data in the |
382 |
channel buffer." |
channel buffer." |
383 |
bool_option true |
bool_option true |
|
|
|
|
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
|
|
|
|
|
|
388 |
(*************************************************************************) |
(*************************************************************************) |
389 |
(* *) |
(* *) |
390 |
(* Networks section *) |
(* Networks section *) |
391 |
(* *) |
(* *) |
392 |
(*************************************************************************) |
(*************************************************************************) |
393 |
|
|
394 |
let current_section = networks_section |
let current_section = networks_section |
395 |
|
|
396 |
let enable_overnet = define_option current_section |
let enable_overnet = define_option current_section |
397 |
["enable_overnet"] |
["enable_overnet"] |
398 |
"Set to true if you also want mldonkey to run as an overnet client (enable_donkey must be true)" |
"Set to true if you also want mldonkey to run as an overnet client (enable_donkey must be true)" |
399 |
bool_option false |
bool_option false |
400 |
|
|
401 |
let enable_kademlia = define_option current_section |
let enable_kademlia = define_option current_section |
402 |
["enable_kademlia"] |
["enable_kademlia"] |
403 |
"Set to true if you also want mldonkey to run as an kademlia client (enable_donkey must be true, and only experimental)" |
"Set to true if you also want mldonkey to run as an kademlia client (enable_donkey must be true, and only experimental)" |
404 |
bool_option false |
bool_option false |
405 |
|
|
406 |
let enable_servers = define_option current_section |
let enable_servers = define_option current_section |
407 |
["enable_servers"] |
["enable_servers"] |
408 |
"Set to true if you also want mldonkey to run with edonkey servers (enable_donkey must be true, and only experimental)" |
"Set to true if you also want mldonkey to run with edonkey servers (enable_donkey must be true, and only experimental)" |
417 |
["enable_donkey"] |
["enable_donkey"] |
418 |
"Set to true if you also want mldonkey to run as a donkey client" |
"Set to true if you also want mldonkey to run as a donkey client" |
419 |
bool_option false |
bool_option false |
420 |
|
|
421 |
let enable_opennap = define_option current_section |
let enable_opennap = define_option current_section |
422 |
["enable_opennap"] |
["enable_opennap"] |
423 |
"Set to true if you also want mldonkey to run as a napster client (experimental)" |
"Set to true if you also want mldonkey to run as a napster client (experimental)" |
424 |
bool_option false |
bool_option false |
425 |
|
|
426 |
let enable_soulseek = define_option current_section |
let enable_soulseek = define_option current_section |
427 |
["enable_soulseek"] |
["enable_soulseek"] |
428 |
"Set to true if you also want mldonkey to run as a soulseek client (experimental)" |
"Set to true if you also want mldonkey to run as a soulseek client (experimental)" |
429 |
bool_option false |
bool_option false |
430 |
|
|
431 |
let enable_gnutella = define_option current_section |
let enable_gnutella = define_option current_section |
432 |
["enable_gnutella"] |
["enable_gnutella"] |
433 |
"Set to true if you also want mldonkey to run as a gnutella1 sub node (experimental)" |
"Set to true if you also want mldonkey to run as a gnutella1 sub node (experimental)" |
437 |
["enable_gnutella2"] |
["enable_gnutella2"] |
438 |
"Set to true if you also want mldonkey to run as a gnutella2 sub node (experimental)" |
"Set to true if you also want mldonkey to run as a gnutella2 sub node (experimental)" |
439 |
bool_option false |
bool_option false |
440 |
|
|
441 |
let enable_fasttrack = define_option current_section |
let enable_fasttrack = define_option current_section |
442 |
["enable_fasttrack"] |
["enable_fasttrack"] |
443 |
"Set to true if you also want mldonkey to run as a Fasttrack sub node (experimental)" |
"Set to true if you also want mldonkey to run as a Fasttrack sub node (experimental)" |
458 |
"Set to true if you also want mldonkey to download HTTP files (experimental)" |
"Set to true if you also want mldonkey to download HTTP files (experimental)" |
459 |
bool_option true |
bool_option true |
460 |
|
|
461 |
|
|
462 |
|
|
463 |
|
|
|
|
|
|
|
|
|
|
|
464 |
(*************************************************************************) |
(*************************************************************************) |
465 |
(* *) |
(* *) |
466 |
(* HTML section *) |
(* HTML section *) |
467 |
(* *) |
(* *) |
468 |
(*************************************************************************) |
(*************************************************************************) |
469 |
|
|
470 |
let current_section = html_section |
let current_section = html_section |
471 |
|
|
472 |
let html_mods = define_expert_option current_section |
let html_mods = define_expert_option current_section |
473 |
["html_mods"] "Whether to use the modified WEB interface" bool_option true |
["html_mods"] "Whether to use the modified WEB interface" bool_option true |
474 |
|
|
525 |
let html_mods_vd_gfx_x_size = define_expert_option current_section |
let html_mods_vd_gfx_x_size = define_expert_option current_section |
526 |
["html_mods_vd_gfx_x_size"] "Graph x size in vd output ( 320 < x < 3600 )" |
["html_mods_vd_gfx_x_size"] "Graph x size in vd output ( 320 < x < 3600 )" |
527 |
int_option 630 |
int_option 630 |
528 |
|
|
529 |
let html_mods_vd_gfx_y_size = define_expert_option current_section |
let html_mods_vd_gfx_y_size = define_expert_option current_section |
530 |
["html_mods_vd_gfx_y_size"] "Graph y size in vd output ( 200 < y < 1200 )" |
["html_mods_vd_gfx_y_size"] "Graph y size in vd output ( 200 < y < 1200 )" |
531 |
int_option 200 |
int_option 200 |
607 |
|
|
608 |
let html_mods_theme = define_option current_section |
let html_mods_theme = define_option current_section |
609 |
["html_mods_theme"] "html_mods_theme to use (located in relative html_themes/<theme_name> directory, leave blank to use internal theme" |
["html_mods_theme"] "html_mods_theme to use (located in relative html_themes/<theme_name> directory, leave blank to use internal theme" |
610 |
string_option "" |
string_option "" |
611 |
|
|
612 |
let use_html_mods o = |
let use_html_mods o = |
613 |
o.CommonTypes.conn_output = CommonTypes.HTML && !!html_mods |
o.CommonTypes.conn_output = CommonTypes.HTML && !!html_mods |
614 |
|
|
615 |
let html_checkbox_vd_file_list = define_expert_option current_section |
let html_checkbox_vd_file_list = define_expert_option current_section |
616 |
["html_checkbox_vd_file_list"] "Whether to use checkboxes in the WEB interface for download list" bool_option true |
["html_checkbox_vd_file_list"] "Whether to use checkboxes in the WEB interface for download list" bool_option true |
617 |
|
|
621 |
let html_use_gzip = define_expert_option current_section |
let html_use_gzip = define_expert_option current_section |
622 |
["html_use_gzip"] "Use gzip compression on web pages" bool_option false |
["html_use_gzip"] "Use gzip compression on web pages" bool_option false |
623 |
|
|
624 |
|
|
625 |
|
|
626 |
|
|
|
|
|
627 |
(*************************************************************************) |
(*************************************************************************) |
628 |
(* *) |
(* *) |
629 |
(* Network section *) |
(* Network section *) |
630 |
(* *) |
(* *) |
631 |
(*************************************************************************) |
(*************************************************************************) |
632 |
|
|
633 |
let current_section = network_section |
let current_section = network_section |
634 |
|
|
635 |
let set_client_ip = define_option current_section ["client_ip"] |
let set_client_ip = define_option current_section ["client_ip"] |
636 |
"The last IP address used for this client" Ip.option |
"The last IP address used for this client" Ip.option |
637 |
(Ip.my ()) |
(Ip.my ()) |
638 |
|
|
639 |
let force_client_ip = define_option current_section ["force_client_ip"] |
let force_client_ip = define_option current_section ["force_client_ip"] |
640 |
"Use the IP specified by 'client_ip' instead of trying to determine it |
"Use the IP specified by 'client_ip' instead of trying to determine it |
641 |
ourself. Don't set this option to true if you have dynamic IP." |
ourself. Don't set this option to true if you have dynamic IP." |
642 |
bool_option false |
bool_option false |
643 |
|
|
644 |
let web_infos = define_option current_section |
let web_infos = define_option current_section |
645 |
["web_infos"] "A list of lines to download on the WEB: each line has |
["web_infos"] "A list of lines to download on the WEB: each line has |
646 |
the format: (kind, period, url), where kind is either |
the format: (kind, period, url), where kind is either |
647 |
'server.met' for a server.met file containing ed2k server, or |
'server.met' for a server.met file containing ed2k server, or |
648 |
'comments.met' for a file of comments, or |
'comments.met' for a file of comments, or |
649 |
'guarding.p2p' for a blocklist file, or |
'guarding.p2p' for a blocklist file, or |
650 |
'ocl' for file in the ocl format containing overnet peers, or |
'ocl' for file in the ocl format containing overnet peers, or |
651 |
'contact.dat' for an contact.dat file containing overnet peers, |
'contact.dat' for an contact.dat file containing overnet peers, |
652 |
and period is the period between updates (in hours), |
and period is the period between updates (in hours), |
653 |
and url is the url of the file to download. |
and url is the url of the file to download. |
654 |
IMPORTANT: Put the URL and the kind between quotes. |
IMPORTANT: Put the URL and the kind between quotes. |
736 |
let http_proxy_tcp = define_option current_section ["http_proxy_tcp"] |
let http_proxy_tcp = define_option current_section ["http_proxy_tcp"] |
737 |
"Direct TCP connections to HTTP proxy (the proxy should support CONNECT)" |
"Direct TCP connections to HTTP proxy (the proxy should support CONNECT)" |
738 |
bool_option false |
bool_option false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
739 |
|
|
740 |
|
|
741 |
|
|
742 |
|
|
743 |
(*************************************************************************) |
(*************************************************************************) |
744 |
(* *) |
(* *) |
745 |
(* Mail section *) |
(* Mail section *) |
770 |
let url_in_mail = define_option current_section ["url_in_mail"] |
let url_in_mail = define_option current_section ["url_in_mail"] |
771 |
"Put a prefix for the filename here which shows up in the notification mail" |
"Put a prefix for the filename here which shows up in the notification mail" |
772 |
string_option "" |
string_option "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
|
|
|
777 |
(*************************************************************************) |
(*************************************************************************) |
778 |
(* *) |
(* *) |
779 |
(* Download section *) |
(* Download section *) |
780 |
(* *) |
(* *) |
781 |
(*************************************************************************) |
(*************************************************************************) |
782 |
|
|
783 |
let current_section = download_section |
let current_section = download_section |
784 |
|
|
785 |
let auto_commit = define_option current_section |
let auto_commit = define_option current_section |
831 |
(* |
(* |
832 |
(Filename.concat bin_dir "mlprogress") |
(Filename.concat bin_dir "mlprogress") |
833 |
*) |
*) |
834 |
|
|
835 |
|
|
836 |
|
|
837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
838 |
(*************************************************************************) |
(*************************************************************************) |
839 |
(* *) |
(* *) |
840 |
(* Startup section *) |
(* Startup section *) |
842 |
(*************************************************************************) |
(*************************************************************************) |
843 |
|
|
844 |
let current_section = startup_section |
let current_section = startup_section |
845 |
|
|
846 |
let run_as_user = define_option current_section ["run_as_user"] |
let run_as_user = define_option current_section ["run_as_user"] |
847 |
"The login of the user you want mldonkey to run as, after the ports |
"The login of the user you want mldonkey to run as, after the ports |
848 |
have been bound (can be use not to run with root priviledges when |
have been bound (can be use not to run with root priviledges when |
849 |
a port < 1024 is needed)" string_option "" |
a port < 1024 is needed)" string_option "" |
850 |
|
|
851 |
let run_as_useruid = define_option current_section ["run_as_useruid"] |
let run_as_useruid = define_option current_section ["run_as_useruid"] |
852 |
"The UID of the user (0=disabled) you want mldonkey to run as, after the ports |
"The UID of the user (0=disabled) you want mldonkey to run as, after the ports |
853 |
have been bound (can be use not to run with root priviledges when |
have been bound (can be use not to run with root priviledges when |
854 |
a port < 1024 is needed)" int_option 0 |
a port < 1024 is needed)" int_option 0 |
855 |
|
|
856 |
|
|
857 |
let ask_for_gui = define_option current_section ["ask_for_gui"] |
let ask_for_gui = define_option current_section ["ask_for_gui"] |
858 |
"Ask for GUI start" bool_option false |
"Ask for GUI start" bool_option false |
859 |
|
|
860 |
let start_gui = define_option current_section ["start_gui"] |
let start_gui = define_option current_section ["start_gui"] |
861 |
"Automatically Start the GUI" bool_option false |
"Automatically Start the GUI" bool_option false |
862 |
|
|
864 |
["recover_temp_on_startup"] |
["recover_temp_on_startup"] |
865 |
"Should MLdonkey try to recover downloads of files in temp/ at startup" |
"Should MLdonkey try to recover downloads of files in temp/ at startup" |
866 |
bool_option true |
bool_option true |
867 |
|
|
868 |
let config_files_security_space = define_expert_option current_section |
let config_files_security_space = define_expert_option current_section |
869 |
["config_files_security_space"] |
["config_files_security_space"] |
870 |
"How many megabytes should MLdonkey keep for saving configuration files." |
"How many megabytes should MLdonkey keep for saving configuration files." |
874 |
"Send an UDP packet to a central servers with the list of servers you |
"Send an UDP packet to a central servers with the list of servers you |
875 |
are currently connected to, for the central server to be able to |
are currently connected to, for the central server to be able to |
876 |
generate accurate server lists." bool_option false |
generate accurate server lists." bool_option false |
|
|
|
|
|
|
|
|
|
877 |
|
|
878 |
|
|
879 |
|
|
880 |
|
|
881 |
(*************************************************************************) |
(*************************************************************************) |
882 |
(* *) |
(* *) |
883 |
(* Path section *) |
(* Path section *) |
898 |
"Name of program used for preview (first arg is local filename, second arg |
"Name of program used for preview (first arg is local filename, second arg |
899 |
is name of file as searched on eDonkey" string_option |
is name of file as searched on eDonkey" string_option |
900 |
"mldonkey_previewer" |
"mldonkey_previewer" |
901 |
|
|
902 |
let mldonkey_bin = define_expert_option current_section ["mldonkey_bin"] |
let mldonkey_bin = define_expert_option current_section ["mldonkey_bin"] |
903 |
"Directory where mldonkey binaries are installed" |
"Directory where mldonkey binaries are installed" |
904 |
string_option bin_dir |
string_option bin_dir |
907 |
"Name of GUI to start" string_option |
"Name of GUI to start" string_option |
908 |
(Filename.concat bin_dir "mlgui") |
(Filename.concat bin_dir "mlgui") |
909 |
|
|
910 |
|
|
911 |
|
|
912 |
|
|
913 |
(*************************************************************************) |
(*************************************************************************) |
914 |
(* *) |
(* *) |
915 |
(* Security section *) |
(* Security section *) |
916 |
(* *) |
(* *) |
917 |
(*************************************************************************) |
(*************************************************************************) |
918 |
|
|
919 |
let current_section = security_section |
let current_section = security_section |
920 |
|
|
921 |
let allowed_commands = define_option current_section |
let allowed_commands = define_option current_section |
922 |
["allowed_commands"] |
["allowed_commands"] |
923 |
"Commands that you are allowed to be call from the interface. These |
"Commands that you are allowed to be call from the interface. These |
938 |
|
|
939 |
let messages_filter = define_option current_section ["messages_filter"] |
let messages_filter = define_option current_section ["messages_filter"] |
940 |
"Regexp of messages to filter out, example: string1\\|string2\\|string3" string_option "Your client is connecting too fast" |
"Regexp of messages to filter out, example: string1\\|string2\\|string3" string_option "Your client is connecting too fast" |
941 |
|
|
942 |
|
|
943 |
|
|
944 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
945 |
(*************************************************************************) |
(*************************************************************************) |
946 |
(* *) |
(* *) |
947 |
(* MLchat section *) |
(* MLchat section *) |
948 |
(* *) |
(* *) |
949 |
(*************************************************************************) |
(*************************************************************************) |
950 |
|
|
951 |
let current_section = mlchat_section |
let current_section = mlchat_section |
952 |
|
|
953 |
(** {2 Chat} *) |
(** {2 Chat} *) |
954 |
|
|
955 |
let chat_app_port = |
let chat_app_port = |
956 |
define_expert_option current_section ["chat_app_port"] |
define_expert_option current_section ["chat_app_port"] |
957 |
"port of the external chat application" |
"port of the external chat application" |
958 |
int_option 5036 |
int_option 5036 |
959 |
|
|
960 |
let chat_app_host = |
let chat_app_host = |
961 |
define_expert_option current_section ["chat_app_host"] |
define_expert_option current_section ["chat_app_host"] |
962 |
"hostname of the external chat application" |
"hostname of the external chat application" |
963 |
string_option "localhost" |
string_option "localhost" |
964 |
|
|
965 |
let chat_port = |
let chat_port = |
966 |
define_expert_option current_section ["chat_port"] |
define_expert_option current_section ["chat_port"] |
967 |
"port used by the external chat application to use the core as a proxy" |
"port used by the external chat application to use the core as a proxy" |
968 |
int_option 4002 |
int_option 4002 |
969 |
|
|
972 |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
973 |
|
|
974 |
let chat_console_id = |
let chat_console_id = |
975 |
define_expert_option current_section ["chat_console_id"] |
define_expert_option current_section ["chat_console_id"] |
976 |
"the id to use for communicating with the core console through chat interface" |
"the id to use for communicating with the core console through chat interface" |
977 |
string_option "donkey console" |
string_option "donkey console" |
978 |
|
|
979 |
let chat_warning_for_downloaded = define_expert_option current_section |
let chat_warning_for_downloaded = define_expert_option current_section |
981 |
"use the chat to indicate when a file has been downloaded" |
"use the chat to indicate when a file has been downloaded" |
982 |
bool_option true |
bool_option true |
983 |
|
|
984 |
|
|
985 |
|
|
986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
(*************************************************************************) |
(*************************************************************************) |
988 |
(* *) |
(* *) |
989 |
(* Other section *) |
(* Other section *) |
990 |
(* *) |
(* *) |
991 |
(*************************************************************************) |
(*************************************************************************) |
992 |
|
|
993 |
let current_section = other_section |
let current_section = other_section |
994 |
|
|
995 |
let save_results = define_option current_section ["save_results"] |
let save_results = define_option current_section ["save_results"] |
1026 |
"The password to access your client from the GUI (setting it disables |
"The password to access your client from the GUI (setting it disables |
1027 |
the command-line client)" string_option "" |
the command-line client)" string_option "" |
1028 |
*) |
*) |
|
|
|
|
(******************** |
|
1029 |
|
|
|
EXPERT OPTIONS |
|
1030 |
|
|
1031 |
*********************) |
|
1032 |
|
|
1033 |
|
(*************************************************************************) |
1034 |
|
(* *) |
1035 |
|
(* EXPERT OPTIONS *) |
1036 |
|
(* *) |
1037 |
|
(*************************************************************************) |
1038 |
|
|
1039 |
let safe_utf8 s = |
let safe_utf8 s = |
1040 |
if Charset.is_utf8 s |
if Charset.is_utf8 s |
1054 |
value_to_utf8 utf8_to_value |
value_to_utf8 utf8_to_value |
1055 |
|
|
1056 |
let utf8_filename_conversions = define_expert_option current_section |
let utf8_filename_conversions = define_expert_option current_section |
1057 |
["utf8_filename_conversions"] |
["utf8_filename_conversions"] |
1058 |
"The conversions to apply on Unicode characters" |
"The conversions to apply on Unicode characters" |
1059 |
(list_option (tuple2_option (int_option, utf8_option))) [] |
(list_option (tuple2_option (int_option, utf8_option))) [] |
1060 |
|
|
1061 |
let client_timeout = define_expert_option current_section ["client_timeout"] |
let client_timeout = define_expert_option current_section ["client_timeout"] |
1062 |
"Timeout on client connections when not queued" float_option 40. |
"Timeout on client connections when not queued" float_option 40. |
1063 |
|
|
1064 |
let interface_buffer = define_expert_option current_section ["interface_buffer"] |
let interface_buffer = define_expert_option current_section ["interface_buffer"] |
1065 |
"The size of the buffer between the client and its GUI. Can be useful |
"The size of the buffer between the client and its GUI. Can be useful |
1066 |
to increase when the connection between them has a small bandwith" int_option |
to increase when the connection between them has a small bandwith" int_option |
1067 |
1000000 |
1000000 |
1073 |
let max_client_name_len = define_expert_option current_section ["max_client_name_len"] |
let max_client_name_len = define_expert_option current_section ["max_client_name_len"] |
1074 |
"The size long client names will be shortened to in the interface" |
"The size long client names will be shortened to in the interface" |
1075 |
int_option 25 |
int_option 25 |
1076 |
|
|
1077 |
let term_ansi = define_expert_option current_section ["term_ansi"] |
let term_ansi = define_expert_option current_section ["term_ansi"] |
1078 |
"Is the default terminal an ANSI terminal (escape sequences can be used)" |
"Is the default terminal an ANSI terminal (escape sequences can be used)" |
1079 |
bool_option true |
bool_option true |
1080 |
|
|
1081 |
let update_gui_delay = define_expert_option current_section ["update_gui_delay"] |
let update_gui_delay = define_expert_option current_section ["update_gui_delay"] |
1082 |
"Delay between updates to the GUI" float_option 1. |
"Delay between updates to the GUI" float_option 1. |
1083 |
|
|
1084 |
let http_realm = |
let http_realm = |
1085 |
define_expert_option current_section ["http_realm"] "The realm shown when connecting with a WEB browser" string_option "MLdonkey" |
define_expert_option current_section ["http_realm"] "The realm shown when connecting with a WEB browser" string_option "MLdonkey" |
1086 |
|
|
1087 |
let use_html_frames = define_expert_option current_section ["use_html_frames"] |
let use_html_frames = define_expert_option current_section ["use_html_frames"] |
1088 |
"This option controls whether the WEB interface should use frames or not" bool_option true |
"This option controls whether the WEB interface should use frames or not" bool_option true |
1089 |
|
|
1091 |
|
|
1092 |
let motd_html = define_expert_option current_section ["motd_html"] |
let motd_html = define_expert_option current_section ["motd_html"] |
1093 |
"Message printed at startup (automatically downloaded from the previous |
"Message printed at startup (automatically downloaded from the previous |
1094 |
URL directory" string_option "Welcome to MLdonkey" |
URL directory" string_option "<br><div align=\"center\"><h3> Welcome to MLdonkey </h3></div>" |
1095 |
|
|
1096 |
let compaction_delay = define_expert_option current_section ["compaction_delay"] |
let compaction_delay = define_expert_option current_section ["compaction_delay"] |
1097 |
"Force compaction every <n> hours (in [1..24])" |
"Force compaction every <n> hours (in [1..24])" |
1098 |
int_option 2 |
int_option 2 |
1099 |
|
|
1100 |
let vd_reload_delay = define_expert_option current_section ["vd_reload_delay"] |
let vd_reload_delay = define_expert_option current_section ["vd_reload_delay"] |
1101 |
"The delay between reloads of the vd output in the WEB interface" |
"The delay between reloads of the vd output in the WEB interface" |
1102 |
int_option 120 |
int_option 120 |
1105 |
"The IP address used to bind the p2p clients" |
"The IP address used to bind the p2p clients" |
1106 |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
Ip.option (Ip.of_inet_addr Unix.inet_addr_any) |
1107 |
|
|
1108 |
let dp500_pclink = |
let dp500_pclink = |
1109 |
define_expert_option current_section ["dp500_pclink"] |
define_expert_option current_section ["dp500_pclink"] |
1110 |
"(experimental)" bool_option false |
"(experimental)" bool_option false |
1111 |
|
|
1112 |
let dp500_port = |
let dp500_port = |
1113 |
define_expert_option current_section ["dp500_port"] |
define_expert_option current_section ["dp500_port"] |
1114 |
"(experimental)" int_option 8000 |
"(experimental)" int_option 8000 |
1115 |
|
|
1116 |
let dp500_buffer = |
let dp500_buffer = |
1117 |
define_expert_option current_section ["dp500_buffer"] |
define_expert_option current_section ["dp500_buffer"] |
1118 |
"(experimental)" int_option 2000000 |
"(experimental)" int_option 2000000 |
1119 |
|
|
1170 |
|
|
1171 |
let create_mlsubmit = |
let create_mlsubmit = |
1172 |
define_expert_option current_section ["create_mlsubmit"] "Should the MLSUBMIT.REG file be created" bool_option true |
define_expert_option current_section ["create_mlsubmit"] "Should the MLSUBMIT.REG file be created" bool_option true |
1173 |
|
|
1174 |
let minor_heap_size = define_expert_option current_section |
let minor_heap_size = define_expert_option current_section |
1175 |
["minor_heap_size"] "Size of the minor heap in kB" |
["minor_heap_size"] "Size of the minor heap in kB" |
1176 |
int_option 32 |
int_option 32 |
1177 |
|
|
1178 |
let min_reask_delay = define_expert_option current_section ["min_reask_delay"] |
let min_reask_delay = define_expert_option current_section ["min_reask_delay"] |
1179 |
"The minimal delay between two connections to the same client (in seconds)" |
"The minimal delay between two connections to the same client (in seconds)" |
1180 |
int_option 600 |
int_option 600 |
1181 |
|
|
1182 |
let display_downloaded_results = define_expert_option current_section |
let display_downloaded_results = define_expert_option current_section |
1183 |
["display_downloaded_results"] "Whether to display results already downloaded" bool_option true |
["display_downloaded_results"] "Whether to display results already downloaded" bool_option true |
1184 |
|
|
1190 |
["client_buffer_size"] "Maximal size of the buffers of a client" |
["client_buffer_size"] "Maximal size of the buffers of a client" |
1191 |
int_option 500000 |
int_option 500000 |
1192 |
|
|
1193 |
let save_options_delay = |
let save_options_delay = |
1194 |
define_expert_option current_section ["save_options_delay"] |
define_expert_option current_section ["save_options_delay"] |
1195 |
"The delay between two saves of the 'downloads.ini' file (default is 15 minutes)" |
"The delay between two saves of the 'downloads.ini' file (default is 15 minutes)" |
1196 |
float_option 900.0 |
float_option 900.0 |
1197 |
|
|
1198 |
let server_connection_timeout = define_expert_option current_section |
let server_connection_timeout = define_expert_option current_section |
1199 |
["server_connection_timeout"] |
["server_connection_timeout"] |
1200 |
"timeout when connecting to a server" float_option 30. |
"timeout when connecting to a server" float_option 30. |
1201 |
|
|
1202 |
let download_sample_rate = define_expert_option current_section ["download_sample_rate"] |
let download_sample_rate = define_expert_option current_section ["download_sample_rate"] |
1203 |
"The delay between one glance at a file and another" float_option 1. |
"The delay between one glance at a file and another" float_option 1. |
1204 |
|
|
1264 |
set this option, mldonkey will log this info in the file until you use the |
set this option, mldonkey will log this info in the file until you use the |
1265 |
'close_log' command. The log file may become very large. You can |
'close_log' command. The log file may become very large. You can |
1266 |
also enable logging in a file after startup using the 'log_file' command." |
also enable logging in a file after startup using the 'log_file' command." |
1267 |
string_option "" |
string_option "" |
1268 |
|
|
1269 |
let verbosity = define_expert_option current_section ["verbosity"] |
let verbosity = define_expert_option current_section ["verbosity"] |
1270 |
"A space-separated list of keywords. Each keyword triggers |
"A space-separated list of keywords. Each keyword triggers |
1271 |
printing information on the corresponding messages: |
printing information on the corresponding messages: |
1272 |
mc : debug client messages |
mc : debug client messages |
1298 |
hid : print hidden errors messages |
hid : print hidden errors messages |
1299 |
" |
" |
1300 |
string_option "" |
string_option "" |
|
|
|
|
|
|
|
|
|
|
|
|
1301 |
|
|
1302 |
|
|
1303 |
|
|
1304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1305 |
(*************************************************************************) |
(*************************************************************************) |
1306 |
(* *) |
(* *) |
1307 |
(* HOOKS On options *) |
(* HOOKS On options *) |
1308 |
(* *) |
(* *) |
1309 |
(*************************************************************************) |
(*************************************************************************) |
1310 |
|
|
1311 |
let current_section = other_section |
let current_section = other_section |
1312 |
|
|
1313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1314 |
let last_high_id = ref Ip.null |
let last_high_id = ref Ip.null |
1315 |
|
|
1316 |
let client_ip sock = |
let client_ip sock = |
1317 |
if !!force_client_ip then !!set_client_ip else |
if !!force_client_ip then !!set_client_ip |
1318 |
if !last_high_id <> Ip.null then begin |
else |
1319 |
if !last_high_id <> Ip.localhost && !!set_client_ip <> !last_high_id then |
if !last_high_id <> Ip.null then begin |
1320 |
set_client_ip =:= !last_high_id; |
if !last_high_id <> Ip.localhost && !!set_client_ip <> !last_high_id then |
1321 |
!last_high_id |
set_client_ip =:= !last_high_id; |
1322 |
end else |
!last_high_id |
1323 |
match sock with |
end |
1324 |
None -> !!set_client_ip |
else |
1325 |
| Some sock -> |
match sock with |
1326 |
let ip = TcpBufferedSocket.my_ip sock in |
None -> !!set_client_ip |
1327 |
if ip <> Ip.localhost && !!set_client_ip <> ip then |
| Some sock -> |
1328 |
set_client_ip =:= ip; |
let ip = TcpBufferedSocket.my_ip sock in |
1329 |
ip |
if ip <> Ip.localhost && !!set_client_ip <> ip then |
1330 |
|
set_client_ip =:= ip; |
1331 |
|
ip |
1332 |
|
|
1333 |
let start_running_plugins = ref false |
let start_running_plugins = ref false |
1334 |
|
|
1335 |
let filter_search_delay = 5.0 |
let filter_search_delay = 5.0 |
1336 |
|
|
1337 |
(* Infer which nets to start depending on the name used *) |
(* Infer which nets to start depending on the name used *) |
1338 |
let _ = |
let _ = |
1339 |
let name = String.lowercase (Filename.basename Sys.argv.(0)) in |
let name = String.lowercase (Filename.basename Sys.argv.(0)) in |
1345 |
let pos = String.index name '.' in |
let pos = String.index name '.' in |
1346 |
String.sub name 0 pos |
String.sub name 0 pos |
1347 |
with _ -> name in |
with _ -> name in |
1348 |
|
|
1349 |
match name with |
match name with |
1350 |
| "mldc" -> enable_directconnect =:= true |
| "mldc" -> enable_directconnect =:= true |
1351 |
| "mlgnut" -> enable_gnutella =:= true |
| "mlgnut" -> enable_gnutella =:= true |
1375 |
String.sub !!global_login 0 prefix_len = prefix then |
String.sub !!global_login 0 prefix_len = prefix then |
1376 |
global_login =:= new_name () |
global_login =:= new_name () |
1377 |
); |
); |
1378 |
|
|
1379 |
let lprintf_to_file = ref false in |
let lprintf_to_file = ref false in |
1380 |
option_hook log_file (fun _ -> |
option_hook log_file (fun _ -> |
1381 |
if !!log_file <> "" then |
if !!log_file <> "" then |
1383 |
let oc = open_out !!log_file in |
let oc = open_out !!log_file in |
1384 |
lprintf_to_file := true; |
lprintf_to_file := true; |
1385 |
if Autoconf.system = "windows" then lprintf "%s" win_message; |
if Autoconf.system = "windows" then lprintf "%s" win_message; |
1386 |
lprintf "Logging in %s\n" !!log_file; |
lprintf_nl "Logging in %s" !!log_file; |
1387 |
log_to_file oc; |
log_to_file oc; |
1388 |
with e -> |
with e -> |
1389 |
lprintf "Exception %s while opening log file: %s\n" |
lprintf_nl "Exception %s while opening log file: %s" |
1390 |
(Printexc2.to_string e) !!log_file |
(Printexc2.to_string e) !!log_file |
1391 |
else |
else |
1392 |
if !lprintf_to_file then begin |
if !lprintf_to_file then begin |
1393 |
lprintf_to_file := false; |
lprintf_to_file := false; |
1394 |
close_log () |
close_log () |
1395 |
end |
end |
1396 |
); |
); |
1397 |
option_hook max_upload_slots (fun _ -> |
option_hook max_upload_slots (fun _ -> |
1398 |
if !!max_upload_slots < 3 then |
if !!max_upload_slots < 3 then |
1399 |
max_upload_slots =:= 3); |
max_upload_slots =:= 3); |
1400 |
option_hook buffer_writes_threshold (fun _ -> |
option_hook buffer_writes_threshold (fun _ -> |
1401 |
Unix32.max_buffered := Int64.of_int (1024 * !!buffer_writes_threshold)); |
Unix32.max_buffered := Int64.of_int (1024 * !!buffer_writes_threshold)); |
1402 |
option_hook log_size (fun _ -> |
option_hook log_size (fun _ -> |
1403 |
lprintf_max_size := !!log_size |
lprintf_max_size := !!log_size |
1404 |
); |
); |
1405 |
option_hook compaction_overhead (fun _ -> |
option_hook compaction_overhead (fun _ -> |
1406 |
let gc_control = Gc.get () in |
let gc_control = Gc.get () in |
1407 |
Gc.set { gc_control with Gc.max_overhead = !!compaction_overhead }; |
Gc.set { gc_control with Gc.max_overhead = !!compaction_overhead }; |
1408 |
); |
); |
1409 |
option_hook web_infos (fun _ -> |
option_hook web_infos (fun _ -> |
1410 |
List.iter (fun remove -> |
List.iter (fun remove -> |
1441 |
network_update_url =:= ""); |
network_update_url =:= ""); |
1442 |
option_hook minor_heap_size (fun _ -> |
option_hook minor_heap_size (fun _ -> |
1443 |
let gc_control = Gc.get () in |
let gc_control = Gc.get () in |
1444 |
Gc.set { gc_control with Gc.minor_heap_size = |
Gc.set { gc_control with Gc.minor_heap_size = |
1445 |
(!!minor_heap_size * 1024) }; |
(!!minor_heap_size * 1024) }; |
1446 |
); |
); |
1447 |
option_hook client_buffer_size (fun _ -> |
option_hook client_buffer_size (fun _ -> |
1448 |
TcpBufferedSocket.max_buffer_size := maxi 50000 !!client_buffer_size |
TcpBufferedSocket.max_buffer_size := maxi 50000 !!client_buffer_size |
1476 |
let verbose_redirector = ref false |
let verbose_redirector = ref false |
1477 |
let verbose_unexpected_messages = ref false |
let verbose_unexpected_messages = ref false |
1478 |
let verbose_hidden_errors = ref false |
let verbose_hidden_errors = ref false |
1479 |
|
|
1480 |
let set_all v = |
let set_all v = |
1481 |
|
|
1482 |
verbose_msg_clients := v; |
verbose_msg_clients := v; |
1483 |
verbose_msg_raw := v; |
verbose_msg_raw := v; |
1484 |
verbose_msg_clienttags := v; |
verbose_msg_clienttags := v; |
1506 |
verbose_redirector := v; |
verbose_redirector := v; |
1507 |
verbose_unexpected_messages := v; |
verbose_unexpected_messages := v; |
1508 |
verbose_hidden_errors := v |
verbose_hidden_errors := v |
1509 |
|
|
1510 |
let _ = |
let _ = |
1511 |
option_hook verbosity (fun _ -> |
option_hook verbosity (fun _ -> |
1512 |
BasicSocket.verbose_bandwidth := 0; |
BasicSocket.verbose_bandwidth := 0; |
1547 |
verbose_sources := 1; |
verbose_sources := 1; |
1548 |
set_all true; |
set_all true; |
1549 |
|
|
1550 |
| _ -> lprintf "Unknown verbosity tag: %s" s |
| _ -> lprintf_nl "Unknown verbosity tag: %s" s |
1551 |
|
|
1552 |
) (String2.split_simplify !!verbosity ' ') |
) (String2.split_simplify !!verbosity ' ') |
1553 |
) |
) |
1608 |
done; |
done; |
1609 |
in |
in |
1610 |
let update v = |
let update v = |
1611 |
lprintf "Updating options to version %i\n" v; |
lprintf_nl "Updating options to version %i" v; |
1612 |
options_version =:= v; |
options_version =:= v; |
1613 |
update_options () |
update_options () |
1614 |
in |
in |
1616 |
match !!options_version with |
match !!options_version with |
1617 |
0 -> |
0 -> |
1618 |
web_infos =:= List.map (fun (kind, period, url) -> |
web_infos =:= List.map (fun (kind, period, url) -> |
1619 |
kind, period * 24, url |
kind, period * 24, url |
1620 |
) !!web_infos; |
) !!web_infos; |
1621 |
web_infos =:= !!web_infos @ [ |
web_infos =:= !!web_infos @ [ |
1622 |
("rss", 6, |
("rss", 6, |
1660 |
update 4 |
update 4 |
1661 |
|
|
1662 |
| _ -> () |
| _ -> () |
|
|
|