/[mldonkey]/mldonkey/src/daemon/common/commonWeb.ml
ViewVC logotype

Diff of /mldonkey/src/daemon/common/commonWeb.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by spiralvoice, Sun Aug 21 16:05:20 2005 UTC revision 1.20 by spiralvoice, Thu Sep 1 00:04:12 2005 UTC
# Line 51  let mldonkey_wget url f = Line 51  let mldonkey_wget url f =
51        H.req_url = Url.of_string url;        H.req_url = Url.of_string url;
52        H.req_proxy = !CommonOptions.http_proxy;        H.req_proxy = !CommonOptions.http_proxy;
53        H.req_user_agent =        H.req_user_agent =
54        Printf.sprintf "MLdonkey/%s" Autoconf.current_version;        Printf.sprintf "MLDonkey/%s" Autoconf.current_version;
55        H.req_max_retry = 20;        H.req_max_retry = 20;
56      } in      } in
57    
58    H.wget r f    H.wget r f
59    
60  let load_url kind url =  let load_url can_fail kind url =
   lprintf_nl "[cWeb] Loading %s" url;  
61    let f =    let f =
62      try      try
63        (List.assoc kind !file_kinds) url        (List.assoc kind !file_kinds) url
64      with e -> failwith (Printf.sprintf "Unknown kind [%s]" kind)      with e -> failwith (Printf.sprintf "Unknown kind [%s]" kind)
65    in    in
66    try    try
67        lprintf_nl "[cWeb] %s loading from %s" kind url;
68      mldonkey_wget url f      mldonkey_wget url f
69    with e -> failwith (Printf.sprintf "Exception %s while loading %s"    with e ->
70        if can_fail then
71          failwith (Printf.sprintf "Exception %s while loading %s"
72            (Printexc2.to_string e) url)            (Printexc2.to_string e) url)
73        else
74          lprintf_nl "[cWeb] Exception %s while loading %s"
75              (Printexc2.to_string e) url
76    
77  let load_file kind file =  let load_file kind file =
78    try    try
# Line 195  let connect_redirector () = Line 200  let connect_redirector () =
200  (*                                                                       *)  (*                                                                       *)
201  (*************************************************************************)  (*************************************************************************)
202    
203  let load_web_infos () =  let load_web_infos core_start =
204  (* Try to connect the redirector to get interesting information, since we  (* Try to connect the redirector to get interesting information, since we
205  are not allowed to use savannah anymore. The redirector should be able to  are not allowed to use savannah anymore. The redirector should be able to
206  support the charge, at least, currently. *)  support the charge, at least, currently. *)
# Line 233  support the charge, at least, currently. Line 238  support the charge, at least, currently.
238                        let servers_met_file = Filename.temp_file "servers" ".met" in                        let servers_met_file = Filename.temp_file "servers" ".met" in
239                        File.from_string servers_met_file servers_met_s;                        File.from_string servers_met_file servers_met_s;
240                        if !!enable_donkey then                        if !!enable_donkey then
241                        load_file "servers.met" servers_met_file;                        load_file "server.met" servers_met_file;
242    
243                        let peers_ocl_file = Filename.temp_file "peers" ".ocl" in                        let peers_ocl_file = Filename.temp_file "peers" ".ocl" in
244                        File.from_string peers_ocl_file peers_ocl_s;                        File.from_string peers_ocl_file peers_ocl_s;
# Line 287  support the charge, at least, currently. Line 292  support the charge, at least, currently.
292      end;      end;
293    
294    if !!network_update_url <> "" then begin    if !!network_update_url <> "" then begin
295      load_url "motd.html" (Filename.concat !!network_update_url "motd.html");      load_url true "motd.html" (Filename.concat !!network_update_url "motd.html");
296      load_url "motd.conf" (Filename.concat !!network_update_url "motd.conf");      load_url true "motd.conf" (Filename.concat !!network_update_url "motd.conf");
297    end;    end;
298    List.iter (fun (kind, period, url) ->    List.iter (fun (kind, period, url) ->
299        if !hours mod period = 0 then      if (core_start && period = 0) || !hours mod period = 0 then
300          match kind with        begin
301          | "contact.dat" -> if !!enable_overnet then load_url kind url          try
302          | "guarding.p2p" -> load_url kind url            load_url false kind url
303          | "kad" -> if !!enable_kademlia then load_url kind url          with e ->
304          | "ocl" -> if !!enable_overnet then load_url kind url              lprintf_nl "[cWeb] %s while loading %s"
305          | "server.met" -> if !!enable_donkey then load_url kind url                (Printexc2.to_string e) url
306          | _ -> lprintf_nl "[cWeb] unparsed kind to refresh: %s" kind; load_url kind url        end
307              ) !!CommonOptions.web_infos    ) !!CommonOptions.web_infos
308    
309  type rss_feed = {  type rss_feed = {
310      mutable rss_date : int;      mutable rss_date : int;

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26