mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey/src daemon/common/commonComplexOptions...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey/src daemon/common/commonComplexOptions...
Date: Sun, 18 Feb 2007 00:13:09 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/02/18 00:13:09

Modified files:
        src/daemon/common: commonComplexOptions.ml commonFile.ml 
                           commonGlobals.ml commonOptions.ml 
                           commonSources.ml commonSwarming.ml 
        src/daemon/driver: driverMain.ml 
        src/networks/bittorrent: bTClients.ml 
        src/networks/donkey: donkeyClient.ml donkeyComplexOptions.ml 
                             donkeyGlobals.ml donkeyOneFile.ml 
                             donkeyProtoCom.ml 
        src/networks/fasttrack: fasttrackHandler.ml 
        src/networks/gnutella: gnutellaServers.ml 
        src/networks/openFT: openFTClients.ml openFTServers.ml 
        src/networks/opennap: opennapClients.ml opennapServers.ml 
        src/utils/lib  : date.ml 

Log message:
        patch #5751

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonComplexOptions.ml?cvsroot=mldonkey&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonFile.ml?cvsroot=mldonkey&r1=1.71&r2=1.72
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonGlobals.ml?cvsroot=mldonkey&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.197&r2=1.198
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonSources.ml?cvsroot=mldonkey&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonSwarming.ml?cvsroot=mldonkey&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverMain.ml?cvsroot=mldonkey&r1=1.135&r2=1.136
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTClients.ml?cvsroot=mldonkey&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyClient.ml?cvsroot=mldonkey&r1=1.121&r2=1.122
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyComplexOptions.ml?cvsroot=mldonkey&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyGlobals.ml?cvsroot=mldonkey&r1=1.115&r2=1.116
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyOneFile.ml?cvsroot=mldonkey&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoCom.ml?cvsroot=mldonkey&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/fasttrack/fasttrackHandler.ml?cvsroot=mldonkey&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/gnutella/gnutellaServers.ml?cvsroot=mldonkey&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/openFT/openFTClients.ml?cvsroot=mldonkey&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/openFT/openFTServers.ml?cvsroot=mldonkey&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/opennap/opennapClients.ml?cvsroot=mldonkey&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/opennap/opennapServers.ml?cvsroot=mldonkey&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/date.ml?cvsroot=mldonkey&r1=1.10&r2=1.11

Patches:
Index: daemon/common/commonComplexOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonComplexOptions.ml,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- daemon/common/commonComplexOptions.ml       6 Feb 2007 22:26:58 -0000       
1.70
+++ daemon/common/commonComplexOptions.ml       18 Feb 2007 00:13:08 -0000      
1.71
@@ -71,15 +71,14 @@
           let get_value name conv = conv (List.assoc name assocs) in
          let get_value_nil name conv =
            try conv (List.assoc name assocs) with Not_found -> [] in
+          let filename = get_value "file_filename" value_to_string in
           let network = try get_value "file_network" value_to_string
             with _ -> "Donkey" in
           let network = 
             try network_find_by_name network with e ->
                 lprintf_nl
                  "Error %s for network %s while parsing file %s"
-                   (Printexc2.to_string e)
-                   network
-                   (get_value "file_filename" value_to_string);
+                   (Printexc2.to_string e) network filename;
     lprintf_nl "This core is lacking support for network %s, exiting" network;
                 exit_properly 70
           in
@@ -110,7 +109,6 @@
             with _ -> ());
 
          let file_user =
-           let filename = get_value "file_filename" value_to_string in
            try
              let u = get_value "file_owner" value_to_string in
                begin
@@ -129,7 +127,6 @@
          set_file_owner file file_user;
 
          let file_group =
-           let filename = get_value "file_filename" value_to_string in
            let dgroup = user2_print_user_default_group file_user in
            try
              match (get_value "file_group" stringvalue_to_option) with
@@ -161,8 +158,7 @@
           set_file_state file file_state;       
 
           (try
-              set_file_best_name file
-              (get_value "file_filename" value_to_string) "" 0
+              set_file_best_name file filename "" 0
             with _ -> ());
 
           (try
@@ -172,12 +168,8 @@
 
           set_file_priority file priority;
 
-          if !verbose then lprintf_nl "New %s file %s"
-             (match file_state with
-                 FileDownloading -> "downloading"
-               | FileDownloaded -> "downloaded"
-               | _ -> "other")
-            (file_best_name file);
+          if !verbose && !CommonGlobals.is_startup_phase then
+            lprintf_nl "Started download of %s" (file_best_name file);
 
           file
       | _ -> assert false

Index: daemon/common/commonFile.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonFile.ml,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- daemon/common/commonFile.ml 2 Dec 2006 12:35:45 -0000       1.71
+++ daemon/common/commonFile.ml 18 Feb 2007 00:13:08 -0000      1.72
@@ -312,7 +312,8 @@
     if name <> real_name then
       lprintf_nl "wanted new name \"%s\" changed to \"%s\" due to system 
limitations"
         (String.escaped name) (String.escaped file.impl_file_best_name);
-    if !verbose && old_name <> file.impl_file_best_name then
+    if !verbose && old_name <> file.impl_file_best_name &&
+       (not !CommonGlobals.is_startup_phase) then
       lprintf_nl "best_name of \"%s\" changed to \"%s\""
         (String.escaped old_name) (String.escaped file.impl_file_best_name)
   end

Index: daemon/common/commonGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- daemon/common/commonGlobals.ml      6 Feb 2007 22:26:58 -0000       1.81
+++ daemon/common/commonGlobals.ml      18 Feb 2007 00:13:08 -0000      1.82
@@ -98,6 +98,8 @@
 
 let patches_string = ref ""
 
+let is_startup_phase = ref true
+
 let version () =
   Printf.sprintf "MLNet %s: Multi-Network p2p client (%s)"
     Autoconf.current_version !networks_string
@@ -147,11 +149,6 @@
     iter !!port_option
   else None
 
-let one_day = 3600. *. 24.
-let half_day = one_day /. 2.
-
-let minutes25 = 25 * 60
-
 let new_connection_control () = {
     control_last_ok = 0;
     control_state = 0;
@@ -160,7 +157,7 @@
   }
 
 let new_connection_control_recent_ok () = {
-    control_last_ok = last_time () - minutes25;
+    control_last_ok = last_time () - (Date.minute_in_secs * 25);
     control_state = 0;
     control_last_try = 0;
     control_min_reask = !!min_reask_delay;
@@ -338,49 +335,6 @@
   (* first GUI have gui_num = 2, since newly created objects have _update = 1 
*)
 let gui_counter = ref 2
 
-  (*
-let ip_of_addr addr f =
-  if addr.addr_name <> "" then
-    if addr.addr_age + !!ip_cache_timeout < last_time () then begin
-        Ip.async_ip  addr.addr_name (fun ip ->
-            addr.addr_ip <- ip;
-            addr.addr_age <- last_time ();
-            f ip)
-      end else
-      f addr.addr_ip
-  else
-    f addr.addr_ip
-
-let sync_ip_of_addr addr =
-  if addr.addr_name <> "" then
-    if addr.addr_age + !!ip_cache_timeout < last_time () then begin
-        let ip = Ip.from_name  addr.addr_name in
-        addr.addr_ip <- ip;
-        addr.addr_age <- last_time ();
-        ip
-      end else
-      addr.addr_ip
-  else
-    addr.addr_ip
-
-let new_addr_ip ip = {
-    addr_ip = ip; addr_name = Ip.to_string ip; addr_age = 0;
-  }
-
-let new_addr_name name = {
-    addr_ip = Ip.null; addr_name = name; addr_age = 0
-  }
-
-let string_of_addr addr =
-  if addr.addr_name = "" then Ip.to_string addr.addr_ip else addr.addr_name
-
-let addr_of_string s =
-  let ip = try Ip.of_string s with _ -> Ip.null in
-  if ip <> Ip.null then new_addr_ip ip else new_addr_name s
-
-let addr_is_ip addr = addr.addr_name = ""
-    *)
-
 let upload_counter = ref Int64.zero
 let download_counter = ref Int64.zero
 let nshared_files = ref 0
@@ -758,11 +712,6 @@
   | VerificationBitmap.State_complete | VerificationBitmap.State_verified -> 
       false
 
-module Connections = struct
-
-  end
-
-
 let parse_magnet url =
   let url = Url.of_string url in
   if url.Url.short_file = "magnet:" then

Index: daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -b -r1.197 -r1.198
--- daemon/common/commonOptions.ml      4 Feb 2007 17:19:50 -0000       1.197
+++ daemon/common/commonOptions.ml      18 Feb 2007 00:13:08 -0000      1.198
@@ -2056,7 +2056,7 @@
   match !!options_version with
     0 ->
       web_infos =:= List.map (fun (kind, period, url) ->
-          kind, period * 24, url
+          kind, period * Date.day_in_hours, url
       ) !!web_infos;
       web_infos =:= !!web_infos @ [
         ("rss", 6,

Index: daemon/common/commonSources.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSources.ml,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- daemon/common/commonSources.ml      3 Dec 2006 20:47:12 -0000       1.41
+++ daemon/common/commonSources.ml      18 Feb 2007 00:13:08 -0000      1.42
@@ -1022,7 +1022,7 @@
        remove_from_queue s r;
        if r.request_score > not_found_score then
          (* query_files will query all files for a source, check that we are
-            realy downloading! example source s has file f1 and file f2,
+            really downloading! example source s has file f1 and file f2,
             file f2 is paused we connect because of f1 and then query both
             files f1 and f2 ... and yes, we do a cleanup ... but a timed one,
             so we can't be sure *)

Index: daemon/common/commonSwarming.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSwarming.ml,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- daemon/common/commonSwarming.ml     4 Feb 2007 17:19:50 -0000       1.58
+++ daemon/common/commonSwarming.ml     18 Feb 2007 00:13:08 -0000      1.59
@@ -1343,7 +1343,7 @@
 let set_frontend_state_verified t j =
   let mark_verified () =
     VB.set t.t_converted_verified_bitmap j VB.State_verified;
-    if !verbose_swarming || !verbose then
+    if (not !CommonGlobals.is_startup_phase) && (!verbose_swarming || 
!verbose) then
       lprintf_nl "Verified block %d/%d of %s"
         (j + 1) t.t_nchunks (file_best_name t.t_file);
     if t.t_primary then begin

Index: daemon/driver/driverMain.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverMain.ml,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- daemon/driver/driverMain.ml 17 Jan 2007 18:53:28 -0000      1.135
+++ daemon/driver/driverMain.ml 18 Feb 2007 00:13:08 -0000      1.136
@@ -421,6 +421,8 @@
     save_results =:= old_save_results;
   end;
 
+  CommonGlobals.is_startup_phase := false;
+
   lprintf_nl (_b "Check http://www.mldonkey.org for updates");
   networks_iter (fun r -> network_load_complex_options r);
   lprintf_nl (_b "enabling networks: ");

Index: networks/bittorrent/bTClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTClients.ml,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- networks/bittorrent/bTClients.ml    2 Dec 2006 12:35:46 -0000       1.85
+++ networks/bittorrent/bTClients.ml    18 Feb 2007 00:13:08 -0000      1.86
@@ -1284,7 +1284,7 @@
       try
         match c.client_sock with
         | Connection sock -> ()
-            (*i think this one is not realy usefull for debugging
+            (*i think this one is not really usefull for debugging
               lprintf_nl "[BT]: RESUME: Client is already connected"; *)
         | _ ->
             (try

Index: networks/donkey/donkeyClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- networks/donkey/donkeyClient.ml     15 Jan 2007 21:32:56 -0000      1.121
+++ networks/donkey/donkeyClient.ml     18 Feb 2007 00:13:09 -0000      1.122
@@ -1375,7 +1375,7 @@
           end;
 
 (*    set_rtimeout sock !!upload_timeout; *)
-          set_lifetime sock one_day;
+          set_lifetime sock (float_of_int Date.day_in_secs);
           add_pending_slot c
         
 with _ -> *)
@@ -2016,7 +2016,7 @@
             (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
+      let client_upload_lifetime = ref ((max 0 !!upload_lifetime) * 
Date.minute_in_secs) in
         
       if !!dynamic_upload_lifetime && not !!upload_complete_chunks
             && c.client_session_uploaded > c.client_session_downloaded

Index: networks/donkey/donkeyComplexOptions.ml
===================================================================
RCS file: 
/sources/mldonkey/mldonkey/src/networks/donkey/donkeyComplexOptions.ml,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- networks/donkey/donkeyComplexOptions.ml     6 Jan 2007 18:15:17 -0000       
1.62
+++ networks/donkey/donkeyComplexOptions.ml     18 Feb 2007 00:13:09 -0000      
1.63
@@ -246,7 +246,7 @@
                 !!temp_directory
                 ( string_of_uid ( Ed2k (Md4.of_string file_md4) ) )
             in
-            lprintf_nl "geting file_diskname from ini failed, testing for 
ed2k-temp-file %s"
+            lprintf_nl "getting file_diskname from ini failed, testing for 
ed2k-temp-file %s"
               filename;
             if Sys.file_exists filename then
               filename
@@ -260,7 +260,7 @@
       (* I think we should die here, to prevent any corruption. *)
       lprintf_nl "ERROR ED2K-TEMP-FILE %s DOES NOT EXIST, THIS WILL PERHAPS 
LEAD TO CORRUPTION IN THAT DOWNLOAD!"
         filename;
-    if !verbose then lprintf_nl "ed2k-temp-file %s used." filename;
+    if !verbose && (not !CommonGlobals.is_startup_phase) then lprintf_nl 
"ed2k-temp-file %s used." filename;
     filename
   in
 

Index: networks/donkey/donkeyGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyGlobals.ml,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -b -r1.115 -r1.116
--- networks/donkey/donkeyGlobals.ml    28 Jan 2007 20:26:46 -0000      1.115
+++ networks/donkey/donkeyGlobals.ml    18 Feb 2007 00:13:09 -0000      1.116
@@ -421,7 +421,7 @@
           impl_file_fd = Some t;
           impl_file_best_name = Filename.basename file_diskname;
           impl_file_filenames = (if filename = "" then [] else [filename]);
-          impl_file_last_seen = last_time () - 100 * 24 * 3600;
+          impl_file_last_seen = last_time () - 100 * Date.day_in_secs;
         }
       in
 
@@ -958,21 +958,20 @@
       with _ -> ()
     end
 
-let half_hour = 30 * 60
 let clean_join_queue_tables () =
   let current_time = last_time () in
 
   let list = Hashtbl2.to_list2 join_queue_by_md4 in
   Hashtbl.clear join_queue_by_md4;
   List.iter (fun (key, ((v,time) as e)) ->
-      if time + half_hour > current_time then
+      if time + Date.half_hour_in_secs > current_time then
         Hashtbl.add join_queue_by_md4 key e
   ) list;
 
   let list = Hashtbl2.to_list2 join_queue_by_id in
   Hashtbl.clear join_queue_by_id;
   List.iter (fun (key, ((v,time) as e)) ->
-      if time + half_hour > current_time then
+      if time + Date.half_hour_in_secs > current_time then
         Hashtbl.add join_queue_by_id key e
   ) list
 

Index: networks/donkey/donkeyOneFile.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOneFile.ml,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- networks/donkey/donkeyOneFile.ml    15 Jan 2007 18:28:03 -0000      1.49
+++ networks/donkey/donkeyOneFile.ml    18 Feb 2007 00:13:09 -0000      1.50
@@ -59,17 +59,15 @@
   match c.client_download with
     Some _ -> ()
   | None ->
-      match c.client_file_queue with
+      (match c.client_file_queue with
         [] -> ()
       | [ (file, chunks, up) ] ->
-          if !verbose_download || c.client_debug then begin
+          if !verbose_download || c.client_debug then
               lprintf_nl "sort_file_queue: single file. client(%d): %s, 
file(%d): %s" (client_num c) c.client_name (file_num file) (file_best_name 
file);
-            end
       | (file, chunks, up) :: _ ->
           let fn = file_num file in
-          if !verbose_download || c.client_debug then begin
+          if !verbose_download || c.client_debug then
               lprintf_nl "sort_file_queue: multiple files. client(%d): %s, 
file(%d): %s" (client_num c) c.client_name (file_num file) (file_best_name 
file);
-            end;
           c.client_file_queue <- List.stable_sort (fun (f1, _, _) (f2, _, _) ->
               let v = file_priority f2 - file_priority f1 in
               if v <> 0 then v else
@@ -81,23 +79,11 @@
                 else 0 in
               s2 - s1
           ) c.client_file_queue;
-          match c.client_file_queue with
+          (match c.client_file_queue with
             [] -> ()
           | (file, chunks, _) :: _ ->
-              if (file_num file) <> fn then begin
-                  if !verbose_download || c.client_debug then begin
-                      lprintf_nl "sort_file_queue: queue change. client(%d): 
%s, file(%d): %s" (client_num c) c.client_name (file_num file) (file_best_name 
file);
-                    end;
-(*
-(*                  c.client_chunks <- chunks; *)
-(*                  c.client_all_chunks <- String.make file.file_nchunks '0'; 
*)
-(*                  c.client_zones <- []; *)
-                  for i = 0 to file.file_nchunks - 1 do
-                    if c.client_chunks.(i)  then
-                      c.client_all_chunks.[i] <- '1';
-done;
-  *)
-                end
+              if (file_num file) <> fn && (!verbose_download || 
c.client_debug) then
+                lprintf_nl "sort_file_queue: queue change. client(%d): %s, 
file(%d): %s" (client_num c) c.client_name (file_num file) (file_best_name 
file)))
 
 let remove_client_slot c =
   if c.client_debug || (

Index: networks/donkey/donkeyProtoCom.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoCom.ml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- networks/donkey/donkeyProtoCom.ml   8 Jan 2007 11:06:42 -0000       1.36
+++ networks/donkey/donkeyProtoCom.ml   18 Feb 2007 00:13:09 -0000      1.37
@@ -78,27 +78,14 @@
 
 let client_send c m =
   let emule_version = c.client_emule_proto in
+  do_if_connected c.client_source.DonkeySources.source_sock (fun sock ->
   if !verbose_msg_clients || c.client_debug then begin
       lprintf_nl "Sent to client %s" (full_client_identifier c);
       DonkeyProtoClient.print m;
       lprint_newline ();
     end;
-  do_if_connected c.client_source.DonkeySources.source_sock (fun sock ->
       direct_client_sock_send emule_version sock m)
 
-  (*
-let emule_send sock m =
-  let m = client_msg_to_string 0xc5 m in
-  (*
-  lprintf "Message to emule client:"; lprint_newline ();
-  LittleEndian.dump m;
-  lprint_newline ();
-  lprint_newline (); *)
-  write_string sock m
-    *)
-
-(* let client_msg_to_string m = client_msg_to_string 227 m *)
-
 let servers_send socks m =
   let m = server_msg_to_string m in
   List.iter (fun s -> write_string s m) socks

Index: networks/fasttrack/fasttrackHandler.ml
===================================================================
RCS file: 
/sources/mldonkey/mldonkey/src/networks/fasttrack/fasttrackHandler.ml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- networks/fasttrack/fasttrackHandler.ml      1 Sep 2006 16:22:15 -0000       
1.20
+++ networks/fasttrack/fasttrackHandler.ml      18 Feb 2007 00:13:09 -0000      
1.21
@@ -118,7 +118,7 @@
     match t with
 
     | M.NodeListReq list ->
-        set_rtimeout sock half_day;
+        set_rtimeout sock (float_of_int Date.half_day_in_secs);
         set_server_state s (Connected (-1));
         s.server_connected <- int64_time ();
         if not (List.memq s !connected_servers) then
@@ -146,7 +146,7 @@
 be connected only AS A NODE. We should transfer this connection to
 the FasttrackSupernode module, and get rid of it. *)
 
-        set_rtimeout sock half_day;
+        set_rtimeout sock (float_of_int Date.half_day_in_secs);
         set_server_state s (Connected (-1));
         s.server_connected <- int64_time ();
         if not (List.memq s !connected_servers) then

Index: networks/gnutella/gnutellaServers.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/gnutella/gnutellaServers.ml,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- networks/gnutella/gnutellaServers.ml        19 Sep 2006 17:07:43 -0000      
1.29
+++ networks/gnutella/gnutellaServers.ml        18 Feb 2007 00:13:09 -0000      
1.30
@@ -488,7 +488,7 @@
     
     if h.hsrpl_content_deflate then deflate_connection sock;
     
-    set_rtimeout sock CommonGlobals.half_day;
+    set_rtimeout sock (float_of_int Date.half_day_in_secs);
     set_server_state s (Connected (-1));
     s.server_connected <- int64_time ();    
     GnutellaHandler.init s sock gconn;

Index: networks/openFT/openFTClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/openFT/openFTClients.ml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- networks/openFT/openFTClients.ml    16 Oct 2005 20:42:54 -0000      1.3
+++ networks/openFT/openFTClients.ml    18 Feb 2007 00:13:09 -0000      1.4
@@ -194,7 +194,7 @@
     match c.client_file with
       None -> disconnect_client c
     | Some file ->
-        set_rtimeout sock half_day;
+        set_rtimeout sock Date.half_day_in_secs;
         begin
           let fd = try
               Unix64.force_fd (file_fd file) 

Index: networks/openFT/openFTServers.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/openFT/openFTServers.ml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- networks/openFT/openFTServers.ml    9 Jan 2006 00:22:36 -0000       1.2
+++ networks/openFT/openFTServers.ml    18 Feb 2007 00:13:09 -0000      1.3
@@ -375,7 +375,7 @@
   if String2.starts_with header gnutella_200_ok then begin
 (*      lprintf "GOOD HEADER FROM ULTRAPEER";
       lprint_newline (); *)
-        set_rtimeout sock DG.half_day;
+        set_rtimeout sock Date.half_day_in_secs;
 (*        lprintf "SPLIT HEADER..."; lprint_newline ();*)
       let lines = Http_client.split_header header in
       match lines with

Index: networks/opennap/opennapClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/opennap/opennapClients.ml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- networks/opennap/opennapClients.ml  12 Nov 2006 12:36:14 -0000      1.11
+++ networks/opennap/opennapClients.ml  18 Feb 2007 00:13:09 -0000      1.12
@@ -229,7 +229,7 @@
 (*    lprintf "CLIENT READER %d BYTES" nread; lprint_newline ();  *)
   if nread = 0 then () else
   let b = buf sock in
-  set_rtimeout sock half_day;
+  set_rtimeout sock Date.half_day_in_secs;
   match !c with
     None -> (* waiting for SENDnick "filename" size *) 
       begin

Index: networks/opennap/opennapServers.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/opennap/opennapServers.ml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- networks/opennap/opennapServers.ml  10 Apr 2006 19:16:36 -0000      1.13
+++ networks/opennap/opennapServers.ml  18 Feb 2007 00:13:09 -0000      1.14
@@ -280,7 +280,7 @@
       login_on_server s sock
       
   | OP.LoginAckReq mail ->
-      set_rtimeout sock DG.half_day;
+      set_rtimeout sock Date.half_day_in_secs;
       lprintf "*****  CONNECTED %s  ******\n" mail;
       set_server_state s (Connected (-1));
       connected_servers := s :: !connected_servers;

Index: utils/lib/date.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/date.ml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- utils/lib/date.ml   19 Jan 2006 02:13:19 -0000      1.10
+++ utils/lib/date.ml   18 Feb 2007 00:13:09 -0000      1.11
@@ -121,8 +121,14 @@
     with e -> failwith (Printf.sprintf "date error %s" (Printexc2.to_string e))
   end
 
-let hour_in_secs = 3600
-let day_in_secs = 24 * hour_in_secs
+let minute_in_secs = 60
+let hour_in_minutes = 60
+let day_in_hours = 24
+let half_hour_in_secs = 30 * minute_in_secs
+let hour_in_secs = 60 * minute_in_secs
+let half_day_in_secs = (day_in_hours / 2) * hour_in_secs
+let day_in_secs = day_in_hours * hour_in_secs
+let day_in_minutes = day_in_hours * hour_in_minutes
 let year_in_secs = 365 * day_in_secs
 
 let time_to_string time print_format =




reply via email to

[Prev in Thread] Current Thread [Next in Thread]