mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Sat, 06 Jan 2007 18:15:17 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/01/06 18:15:17

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonGlobals.ml commonTypes.ml 
        src/gtk2/gui   : guiMisc.ml 
        src/networks/donkey: donkeyClient.ml donkeyComplexOptions.ml 
                             donkeyFiles.ml donkeyGlobals.ml 
                             donkeyInteractive.ml donkeyMain.ml 
                             donkeyMftp.ml donkeyOneFile.ml 
                             donkeyPandora.ml donkeyProtoClient.ml 
                             donkeyProtoCom.ml donkeyProtoServer.ml 
                             donkeyShare.ml donkeyTypes.ml 
        src/networks/fasttrack: fasttrackProto.ml 

Log message:
        patch #5599

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1135&r2=1.1136
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonGlobals.ml?cvsroot=mldonkey&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonTypes.ml?cvsroot=mldonkey&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/gtk2/gui/guiMisc.ml?cvsroot=mldonkey&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyClient.ml?cvsroot=mldonkey&r1=1.114&r2=1.115
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyComplexOptions.ml?cvsroot=mldonkey&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyFiles.ml?cvsroot=mldonkey&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyGlobals.ml?cvsroot=mldonkey&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyInteractive.ml?cvsroot=mldonkey&r1=1.145&r2=1.146
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyMain.ml?cvsroot=mldonkey&r1=1.64&r2=1.65
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyMftp.ml?cvsroot=mldonkey&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyOneFile.ml?cvsroot=mldonkey&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyPandora.ml?cvsroot=mldonkey&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoClient.ml?cvsroot=mldonkey&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoCom.ml?cvsroot=mldonkey&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoServer.ml?cvsroot=mldonkey&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyShare.ml?cvsroot=mldonkey&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyTypes.ml?cvsroot=mldonkey&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/fasttrack/fasttrackProto.ml?cvsroot=mldonkey&r1=1.18&r2=1.19

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1135
retrieving revision 1.1136
diff -u -b -r1.1135 -r1.1136
--- distrib/ChangeLog   6 Jan 2007 17:37:11 -0000       1.1135
+++ distrib/ChangeLog   6 Jan 2007 18:15:16 -0000       1.1136
@@ -15,6 +15,7 @@
 =========
 
 2007/01/06
+5599: EDK: Support for file's sizes >4GB (TripleM, pango)
 5660: Swarming: Enable wrongly disabled select block memoization (pango)
 5659: GD: Fix wrong months display (skeeve)
 

Index: src/daemon/common/commonGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- src/daemon/common/commonGlobals.ml  3 Dec 2006 20:49:42 -0000       1.78
+++ src/daemon/common/commonGlobals.ml  6 Jan 2007 18:15:17 -0000       1.79
@@ -398,6 +398,7 @@
   | Field_Completesources -> "completesources"
   | Field_Filename -> "filename"
   | Field_Size -> "size"
+  | Field_Size_Hi -> "size_hi"
   | Field_Uid -> "uid"
   | Field_Bitrate -> "bitrate"
   | Field_Codec -> "codec"
@@ -420,6 +421,7 @@
   | "completesources" -> Field_Completesources
   | "filename" -> Field_Filename
   | "size" -> Field_Size
+  | "size_hi" -> Field_Size_Hi
   | "uid" -> Field_Uid
   | "bitrate" -> Field_Bitrate
   | "codec" -> Field_Codec

Index: src/daemon/common/commonTypes.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonTypes.ml,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- src/daemon/common/commonTypes.ml    3 Dec 2006 20:49:42 -0000       1.65
+++ src/daemon/common/commonTypes.ml    6 Jan 2007 18:15:17 -0000       1.66
@@ -260,6 +260,7 @@
 | Field_Completesources (* "completesources" *)
 | Field_Filename (* "filename" *)
 | Field_Size
+| Field_Size_Hi
 | Field_Uid
 | Field_Filerating
 | Field_Lastseencomplete

Index: src/gtk2/gui/guiMisc.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/gtk2/gui/guiMisc.ml,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- src/gtk2/gui/guiMisc.ml     3 Dec 2006 20:49:42 -0000       1.22
+++ src/gtk2/gui/guiMisc.ml     6 Jan 2007 18:15:17 -0000       1.23
@@ -1050,6 +1050,7 @@
     | Field_Completesources -> "completesources"
     | Field_Filename -> "filename"
     | Field_Size -> "size"
+    | Field_Size_Hi -> "size_hi"
     | Field_Uid -> "uid"
     | Field_Medialength -> "length"
     | Field_Mediacodec -> "codec"

Index: src/networks/donkey/donkeyClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- src/networks/donkey/donkeyClient.ml 3 Dec 2006 20:49:42 -0000       1.114
+++ src/networks/donkey/donkeyClient.ml 6 Jan 2007 18:15:17 -0000       1.115
@@ -1576,8 +1576,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 && 
@@ -1588,12 +1587,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
@@ -1601,8 +1601,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

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 -b -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.23
diff -u -b -r1.22 -r1.23
--- src/networks/donkey/donkeyFiles.ml  21 Nov 2006 22:34:33 -0000      1.22
+++ src/networks/donkey/donkeyFiles.ml  6 Jan 2007 18:15:17 -0000       1.23
@@ -83,12 +83,14 @@
            (file_best_name file) (full_client_identifier c)
             (begin_pos) (len_int);
         
+        if file_is_largefile file && c.client_emule_proto.emule_largefiles <> 
1 then raise Donkey_large_file;
         let msg =  
           (
             let module M = DonkeyProtoClient in
             let module B = M.Bloc in
             M.BlocReq {  
               B.md4 = file.file_md4;
+              B.usesixtyfour = (begin_pos ++ (Int64.of_int len_int)) > 
old_max_emule_file_size;
               B.start_pos = begin_pos;
               B.end_pos = begin_pos ++ (Int64.of_int len_int);
               B.bloc_str = "";
@@ -114,7 +116,9 @@
         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?"
+      | End_of_file -> lprintf_nl "Can not send file %s to %s, file removed?"
+                        (file_best_name file) (full_client_identifier c)
+      | Donkey_large_file -> lprintf_nl "File %s is too large for %s."
                         (file_best_name file) (full_client_identifier c)
       | e -> if !verbose then lprintf_nl
               "Exception %s in send_small_block" (Printexc2.to_string e)

Index: src/networks/donkey/donkeyGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyGlobals.ml,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- src/networks/donkey/donkeyGlobals.ml        4 Dec 2006 12:00:19 -0000       
1.112
+++ src/networks/donkey/donkeyGlobals.ml        6 Jan 2007 18:15:17 -0000       
1.113
@@ -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)

Index: src/networks/donkey/donkeyInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyInteractive.ml,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -b -r1.145 -r1.146
--- src/networks/donkey/donkeyInteractive.ml    6 Dec 2006 22:33:05 -0000       
1.145
+++ src/networks/donkey/donkeyInteractive.ml    6 Jan 2007 18:15:17 -0000       
1.146
@@ -430,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
@@ -560,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
@@ -600,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

Index: src/networks/donkey/donkeyMain.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyMain.ml,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- src/networks/donkey/donkeyMain.ml   3 Dec 2006 20:49:42 -0000       1.64
+++ src/networks/donkey/donkeyMain.ml   6 Jan 2007 18:15:17 -0000       1.65
@@ -154,7 +154,7 @@
   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 *) *)

Index: src/networks/donkey/donkeyMftp.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyMftp.ml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/networks/donkey/donkeyMftp.ml   4 Dec 2006 12:00:19 -0000       1.15
+++ src/networks/donkey/donkeyMftp.ml   6 Jan 2007 18:15:17 -0000       1.16
@@ -213,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;

Index: src/networks/donkey/donkeyOneFile.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOneFile.ml,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- src/networks/donkey/donkeyOneFile.ml        21 Nov 2006 22:34:34 -0000      
1.46
+++ src/networks/donkey/donkeyOneFile.ml        6 Jan 2007 18:15:17 -0000       
1.47
@@ -228,6 +228,16 @@
       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 +249,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 +261,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 +273,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;
@@ -472,8 +485,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/donkeyPandora.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyPandora.ml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- 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
@@ -139,11 +139,22 @@
             begin
               try
                 let options = find_tag (Field_KNOWN "emule_miscoptions1") tags 
in
+                (
                 match options with
-                  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.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- src/networks/donkey/donkeyProtoClient.ml    3 Dec 2006 20:49:42 -0000       
1.42
+++ src/networks/donkey/donkeyProtoClient.ml    6 Jan 2007 18:15:17 -0000       
1.43
@@ -65,7 +65,7 @@
     emule_request_crypt = 0;
     emule_support_crypt = 0;
     emule_extmultipacket = 0;
-    emule_largefiles = 0;
+    emule_largefiles = 1;
     emule_kad_version = 0;
   }
 
@@ -118,13 +118,10 @@
   Buffer.contents buf
 
 let emule_miscoptions2 m =
-(*
   let o =
     (m.emule_largefiles lsl 4)
   in
   Int64.of_int o
-*)
-  Int64.zero
 
 let update_emule_proto_from_miscoptions2 m o =
   let o = Int64.to_int o in
@@ -493,6 +490,7 @@
 module Bloc  = struct
     type t = {
         md4 : Md4.t;
+        usesixtyfour : bool;
         start_pos : int64;
         end_pos: int64;
         bloc_str: string;
@@ -500,14 +498,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 =
@@ -518,14 +517,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;
@@ -534,15 +534,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 =
@@ -554,12 +555,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 = ()
@@ -1082,6 +1083,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
 
@@ -1139,7 +1169,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 =
@@ -1208,9 +1238,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) ->
@@ -1257,11 +1286,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)
@@ -1344,6 +1369,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
 
@@ -1369,8 +1398,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)
@@ -1462,6 +1491,8 @@
     | EmuleQueueRankingReq _
     | EmuleCompressedPart _
       -> 0xC5
+    | QueryBlocReq t when t.QueryBloc.usesixtyfour -> 0xC5
+    | BlocReq t when t.Bloc.usesixtyfour -> 0xC5
     | _
       ->  227
   in
@@ -1483,10 +1514,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;
@@ -1570,13 +1601,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.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- src/networks/donkey/donkeyProtoCom.ml       2 Dec 2006 12:35:46 -0000       
1.34
+++ src/networks/donkey/donkeyProtoCom.ml       6 Jan 2007 18:15:17 -0000       
1.35
@@ -234,7 +234,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

Index: src/networks/donkey/donkeyProtoServer.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoServer.ml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- 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
@@ -808,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/donkeyShare.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyShare.ml,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- src/networks/donkey/donkeyShare.ml  3 Dec 2006 20:57:56 -0000       1.56
+++ src/networks/donkey/donkeyShare.ml  6 Jan 2007 18:15:17 -0000       1.57
@@ -184,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;
 

Index: src/networks/donkey/donkeyTypes.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyTypes.ml,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- src/networks/donkey/donkeyTypes.ml  2 Dec 2006 12:35:46 -0000       1.54
+++ src/networks/donkey/donkeyTypes.ml  6 Jan 2007 18:15:17 -0000       1.55
@@ -32,6 +32,8 @@
 let lprintf_n fmt =
   lprintf2 log_prefix fmt
 
+exception Donkey_large_file
+
 type emule_proto = {
     mutable emule_version : int;
     mutable emule_release : string;
@@ -732,3 +734,9 @@
 
 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/fasttrack/fasttrackProto.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/fasttrack/fasttrackProto.ml,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- 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
@@ -145,6 +145,7 @@
   | Field_Lastseencomplete
   | Field_Mediacodec
   | Field_Medialength
+  | Field_Size_Hi
   | Field_UNKNOWN _
   | Field_KNOWN _ ->
       string_tag tag s
@@ -1953,6 +1954,7 @@
     | Field_Lastseencomplete
     | Field_Mediacodec
     | Field_Medialength
+          | Field_Size_Hi
           | Field_Size -> ()
         end
     | QHasMinVal (field, value) ->




reply via email to

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