mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/donkey/...
Date: Mon, 08 Jan 2007 12:20:40 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/01/08 12:20:40

Modified files:
        distrib        : ChangeLog 
        src/networks/donkey: donkeyClient.ml donkeyOneFile.ml 
                             donkeyOptions.ml donkeyProtoClient.ml 

Log message:
        patch #5596

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1140&r2=1.1141
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyClient.ml?cvsroot=mldonkey&r1=1.116&r2=1.117
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyOneFile.ml?cvsroot=mldonkey&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyOptions.ml?cvsroot=mldonkey&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/donkey/donkeyProtoClient.ml?cvsroot=mldonkey&r1=1.44&r2=1.45

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1140
retrieving revision 1.1141
diff -u -b -r1.1140 -r1.1141
--- distrib/ChangeLog   8 Jan 2007 11:06:42 -0000       1.1140
+++ distrib/ChangeLog   8 Jan 2007 12:20:40 -0000       1.1141
@@ -15,6 +15,15 @@
 =========
 
 2007/01/08
+5596: EDK: New option upload_full_chunks (thx to TripleM)
+- If the new option upload_full_chunks is set to true, each client is
+  allowed to receive one chunk, this setting overrides upload_lifetime.
+  Well, not exactly one chunk. eMule has this code in opcode.h:
+    #define SESSIONMAXTRANS (PARTSIZE+20*1024) //
+    "Try to send complete chunks" always sends this amount of data
+  MLdonkey now does the same, if upload_full_chunks is true and client A got
+  9728000+20*1024 bytes during the current session its upload slot will be
+  revoked unless pending slots are empty.
 5619: EDK: Print network specific infos in command "vc <num>",
       remove unneeded fields from client structures
 5627: commonHasher: fix wrong arg types from several functions (Schlumpf)

Index: src/networks/donkey/donkeyClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyClient.ml,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -b -r1.116 -r1.117
--- src/networks/donkey/donkeyClient.ml 8 Jan 2007 11:06:42 -0000       1.116
+++ src/networks/donkey/donkeyClient.ml 8 Jan 2007 12:20:40 -0000       1.117
@@ -248,24 +248,7 @@
       c.client_source.DonkeySources.source_sock <- NoConnection
   | Connection sock ->
       (try
-    let log_print cc = lprintf_nl "Client[%d] %s disconnected, connected 
%s%s%s"
-      (client_num c) (full_client_identifier c)
-      (Date.time_to_string (last_time () - c.client_connect_time) "verbose")
-      (if c.client_total_uploaded > 0L then
-        Printf.sprintf ", send %s (%s)%s"
-          (size_of_int64 c.client_session_uploaded)
-          (size_of_int64 c.client_total_uploaded)
-          (match client_upload (as_client c) with | None -> ""
-           | Some f -> " of " ^ (CommonFile.file_best_name f)) else "")
-      (if c.client_total_downloaded > 0L then
-        Printf.sprintf ", rec %s (%s)"
-          (size_of_int64 c.client_session_downloaded)
-          (size_of_int64 c.client_total_downloaded) else "")
-    in
-    if c.client_debug ||
-      (!verbose && (c.client_session_uploaded > 0L || 
c.client_session_downloaded > 0L)) then
-      log_print c;
-
+          DonkeyOneFile.remove_client_slot c;
           c.client_comp <- None;
           (try if c.client_checked then count_seen c with _ -> ());
           (try if !!log_clients_on_console && c.client_name <> "" then 
@@ -273,14 +256,11 @@
           c.client_connect_time <- 0;
           (try Hashtbl.remove connected_clients c.client_md4 with _ -> ());
           (try CommonUploads.remove_pending_slot (as_client c) with _ -> ());
-          set_client_has_a_slot (as_client c) NoSlot;
-(*          connection_failed c.client_connection_control; *)
           (try TcpBufferedSocket.close sock reason with _ -> ());
 
 (* Remove the Connected and NoLimit tags *)
           set_client_type c (client_type c
               land (lnot (client_initialized_tag lor client_nolimit_tag)));
-(*          c.client_chunks <- [||];*)
           c.client_source.DonkeySources.source_sock <- NoConnection;
           save_join_queue c;
           c.client_slot <- SlotNotAsked;
@@ -293,23 +273,10 @@
           )
           files;    
           c.client_file_queue <- [];  
-          if c.client_upload != None then CommonUploads.refill_upload_slots ();
+          c.client_session_downloaded <- 0L;
         
         with e -> lprintf_nl "Exception %s in disconnect_client"
               (Printexc2.to_string e));
-(*      lprintf "Client %d to source:" (client_num c);
-      List.iter (fun r ->
-                lprint_char (
-                  match r.request_result with
-                  | File_chunk ->      'C'
-                  | File_upload ->     'U'
-                  | File_not_found ->  '-'
-                  | File_found ->      '+'
-                  | File_possible ->   '?'
-                  | File_expected ->   '!'
-                  | File_new_source -> 'n'
-                )) c.client_files;      
-      lprintf "\n"; *)
       set_client_disconnected c reason;
       DonkeySources.source_disconnected c.client_source
   
@@ -1419,7 +1386,7 @@
             | Some f -> CommonFile.file_best_name f);
 (*      end *)
   
-  | M.CloseSlotReq _ ->
+  | M.OutOfPartsReq _ ->
       set_client_state c (Connected 0);
       begin
         match c.client_download with
@@ -1430,6 +1397,7 @@
             CommonSwarming.clear_uploader_ranges up
       end;
 (*      DonkeyOneFile.clean_current_download c; *)
+      c.client_session_downloaded <- 0L;
       c.client_slot <- SlotNotAsked;
 (* OK, the slot is closed, but what should we do now ????? *)
       begin
@@ -1437,7 +1405,7 @@
           [] -> ()
         | _ -> 
             if !verbose_download then
-                lprintf_nl "CloseSlotReq"; 
+                lprintf_nl "OutOfPartsReq"; 
             DonkeyOneFile.request_slot c;
             set_rtimeout sock !!queued_timeout;
       end
@@ -2026,13 +1994,20 @@
   | M.QueryBlocReq t when !CommonUploads.has_upload = 0 &&
     client_has_a_slot (as_client c) ->
       
-      if !verbose_upload then
-          lprintf_nl "donkeyClient: uploader %s ask for block" 
(full_client_identifier c);
-      
       let module Q = M.QueryBloc in
       let file = find_file  t.Q.md4 in
+
+      if !verbose_upload then lprintf_nl "donkeyClient: uploader %s asks for 
%s"
+            (full_client_identifier c) (file_best_name file);
+
       let prio = (file_priority file) in
       let client_upload_lifetime = ref ((max 0 !!upload_lifetime) * 60) in
+      let client_received_enough c =
+        if !!upload_full_chunks then
+          c.client_session_uploaded > (block_size ++ 20L ** 1024L)
+        else
+          last_time() > c.client_connect_time + !client_upload_lifetime + 5 * 
prio
+      in
       begin
         
         if !!dynamic_upload_lifetime
@@ -2043,13 +2018,15 @@
           Int64.to_int 
             (Int64.of_int !client_upload_lifetime 
               ** c.client_session_downloaded // c.client_session_uploaded);
-        if last_time() > c.client_connect_time + 
-            !client_upload_lifetime + 5 * prio then
+        if client_received_enough c then
+          if Intmap.length !CommonUploads.pending_slots_map = 0 then
           begin
-
-(* And what happens if we were downloading from this client also ? *)
-            
-            disconnect_client c (Closed_for_error "Upload lifetime expired");
+              if !verbose_upload then lprintf_nl
+                "donkeyClient: not closing upload slot of %s (%s), pending 
slots empty, sending next block..."
+                  (full_client_identifier c) (file_best_name file)
+            end
+          else begin
+            DonkeyOneFile.remove_client_slot c;
             raise Not_found
           end;
         

Index: src/networks/donkey/donkeyOneFile.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOneFile.ml,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- src/networks/donkey/donkeyOneFile.ml        6 Jan 2007 18:15:17 -0000       
1.47
+++ src/networks/donkey/donkeyOneFile.ml        8 Jan 2007 12:20:40 -0000       
1.48
@@ -100,11 +100,28 @@
                 end
 
 let remove_client_slot c =
+  if c.client_debug || (
+     !verbose &&
+     (c.client_session_uploaded > 0L || c.client_session_downloaded > 0L)) then
+    lprintf_nl "Client[%d] %s disconnected, connected %s%s%s"
+      (client_num c) (full_client_identifier c)
+      (Date.time_to_string (last_time () - c.client_connect_time) "verbose")
+      (if c.client_total_uploaded > 0L then
+        Printf.sprintf ", send %s (%s)%s"
+          (size_of_int64 c.client_session_uploaded)
+          (size_of_int64 c.client_total_uploaded)
+          (match client_upload (as_client c) with | None -> ""
+           | Some f -> " of " ^ (CommonFile.file_best_name f)) else "")
+      (if c.client_total_downloaded > 0L then
+        Printf.sprintf ", rec %s (%s)"
+          (size_of_int64 c.client_session_downloaded)
+          (size_of_int64 c.client_total_downloaded) else "");
   set_client_has_a_slot (as_client c) NoSlot;
   client_send c (
     let module M = DonkeyProtoClient in
-    let module Q = M.CloseSlot in
-    M.CloseSlotReq Q.t);
+    let module Q = M.OutOfParts in
+    M.OutOfPartsReq Q.t);
+  c.client_session_uploaded <- 0L;
   c.client_upload <- None
 
 let unshare_file file =

Index: src/networks/donkey/donkeyOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyOptions.ml,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- src/networks/donkey/donkeyOptions.ml        26 Nov 2006 16:36:29 -0000      
1.57
+++ src/networks/donkey/donkeyOptions.ml        8 Jan 2007 12:20:40 -0000       
1.58
@@ -174,6 +174,10 @@
   "How long a downloading client can stay in my upload queue (in minutes >5)"
     int_option 90
 
+let upload_full_chunks = define_expert_option donkey_section 
["upload_full_chunks"]
+  "If true, each client is allowed to receive one chunk, this setting 
overrides upload_lifetime"
+    bool_option false
+
 let dynamic_upload_lifetime = define_expert_option donkey_section 
["dynamic_upload_lifetime"]
   "Each client upload lifetime depends on download-upload ratio"
     bool_option false

Index: src/networks/donkey/donkeyProtoClient.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/donkey/donkeyProtoClient.ml,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- src/networks/donkey/donkeyProtoClient.ml    8 Jan 2007 11:06:42 -0000       
1.44
+++ src/networks/donkey/donkeyProtoClient.ml    8 Jan 2007 12:20:40 -0000       
1.45
@@ -587,7 +587,7 @@
 
 module AvailableSlot = NoArg(struct let m = "AvailableSlot" end)
 module ReleaseSlot = NoArg(struct let m = "ReleaseSlot" end)
-module CloseSlot = NoArg(struct let m = "CloseSlot" end)
+module OutOfParts = NoArg(struct let m = "OutOfParts" end)
 module ViewFiles = NoArg(struct let m = "VIEW FILES" end)
 module ViewDirs = NoArg(struct let m = "VIEW DIRS" end)
 
@@ -1138,7 +1138,7 @@
 | JoinQueueReq of JoinQueue.t (* sent before queryBloc *)
 | AvailableSlotReq of AvailableSlot.t
 | ReleaseSlotReq of ReleaseSlot.t
-| CloseSlotReq of CloseSlot.t
+| OutOfPartsReq of OutOfParts.t
 | QueryChunksReq of QueryChunks.t
 | QueryChunksReplyReq of QueryChunksReply.t
 | QueryChunkMd4Req of QueryChunkMd4.t
@@ -1185,7 +1185,7 @@
     | JoinQueueReq t -> JoinQueue.print t
     | AvailableSlotReq t -> AvailableSlot.print t
     | ReleaseSlotReq t -> ReleaseSlot.print t
-    | CloseSlotReq t -> CloseSlot.print t
+    | OutOfPartsReq t -> OutOfParts.print t
     | QueryChunksReq t -> QueryChunks.print t
     | QueryChunksReplyReq t -> QueryChunksReply.print t
     | QueryChunkMd4Req t -> QueryChunkMd4.print t
@@ -1418,8 +1418,8 @@
           | 85 -> AvailableSlotReq (AvailableSlot.parse len s)
 (* ReleaseSlot: the upload is finished *)
           | 86 -> ReleaseSlotReq (ReleaseSlot.parse len s)
-(* CloseSlot: the upload slot is not available *)
-          | 87 -> CloseSlotReq (CloseSlot.parse len s)
+(* OutOfParts: the upload slot is not available *)
+          | 87 -> OutOfPartsReq (OutOfParts.parse len s)
           | 88 -> QueryFileReq (QueryFile.parse emule_version len s)
           | 89 -> QueryFileReplyReq (QueryFileReply.parse len s)
           | 92 -> QueueRankReq (QueueRank.parse len s)
@@ -1541,9 +1541,9 @@
     | ReleaseSlotReq t ->
         buf_int8 buf 86;
         ReleaseSlot.write buf t
-    | CloseSlotReq t ->
+    | OutOfPartsReq t ->
         buf_int8 buf 87;
-        CloseSlot.write buf t
+        OutOfParts.write buf t
     | ViewFilesReq t ->
         buf_int8 buf 74;
         ViewFiles.write buf t




reply via email to

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