Index: src/daemon/common/commonGlobals.ml
===================================================================
RCS file: /cvsroot/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v
retrieving revision 1.50
diff -u -r1.50 commonGlobals.ml
--- src/daemon/common/commonGlobals.ml	28 Aug 2005 12:18:30 -0000	1.50
+++ src/daemon/common/commonGlobals.ml	31 Aug 2005 22:51:41 -0000
@@ -278,7 +278,7 @@
 
 let download_control = TcpBufferedSocket.create_read_bandwidth_controler
   "Download"
-    (!!max_hard_download_rate * 2048) (* TODO: changed from 1024 to 2048 because of bug *)
+    (!!max_hard_download_rate * 1024)
 
 
 let _ =
@@ -288,7 +288,7 @@
   option_hook max_hard_download_rate (fun _ ->
       let rate = !!max_hard_download_rate in
       TcpBufferedSocket.change_rate download_control
-        (rate * 2048)) (* TODO: changed from 1024 to 2048 because of bug *)
+        (rate * 1024))
 
 let udp_write_controler = UdpSocket.new_bandwidth_controler upload_control
 
Index: src/networks/bittorrent/bTClients.ml
===================================================================
RCS file: /cvsroot/mldonkey/mldonkey/src/networks/bittorrent/bTClients.ml,v
retrieving revision 1.48
diff -u -r1.48 bTClients.ml
--- src/networks/bittorrent/bTClients.ml	15 Aug 2005 20:30:11 -0000	1.48
+++ src/networks/bittorrent/bTClients.ml	31 Aug 2005 22:51:49 -0000
@@ -763,13 +763,9 @@
               Int64Swarmer.downloaded swarmer in
 
             (*Update rate and amount of data received from client*)
-            c.client_downloaded <- c.client_downloaded ++
-              (new_downloaded -- old_downloaded);
+            count_download c file (new_downloaded -- old_downloaded);
             (* use len here with max_dr quickfix *)
             Rate.update c.client_downloaded_rate  (float_of_int len);
-            (* update the stats *)
-            let len64 = Int64.of_int len in
-            count_download c file len64;
             network_must_update network;
             if !verbose_msg_clients then
               (match c.client_ranges_sent with
@@ -1455,14 +1451,13 @@
           let file = c.client_file in
           let offset = pos ++ file.file_piece_size *.. num in
           c.client_allowed_to_write <- c.client_allowed_to_write -- len;
-          c.client_uploaded <- c.client_uploaded ++ len;
+          count_upload c file len;
           let len = Int64.to_int len in
           CommonUploads.consume_bandwidth len;
 (*          lprintf "Unix32.read: offset %Ld len %d\n" offset len; *)
           Unix32.read (file_fd file) offset upload_buffer 0 len;
           (* update upload rate from len bytes *)
-          (* will be reverted to len instead of len / 2 when rate bug will be fixed *)
-          Rate.update c.client_upload_rate  (float_of_int (len / 2));
+          Rate.update c.client_upload_rate  (float_of_int len);
           file.file_uploaded <- file.file_uploaded ++ (Int64.of_int len);
           let _ =
             (* update stats *)
@@ -1477,9 +1472,6 @@
           in
 (*          lprintf "sending piece\n"; *)
           send_client c (Piece (num, pos, upload_buffer, 0, len));
-          (* update stats *)
-          let uploaded = Int64.of_int len in
-          count_upload c file uploaded;
           network_must_update network;
           iter_upload sock c
         end else
Index: src/networks/donkey/donkeyOneFile.ml
===================================================================
RCS file: /cvsroot/mldonkey/mldonkey/src/networks/donkey/donkeyOneFile.ml,v
retrieving revision 1.26
diff -u -r1.26 donkeyOneFile.ml
--- src/networks/donkey/donkeyOneFile.ml	18 Aug 2005 13:00:03 -0000	1.26
+++ src/networks/donkey/donkeyOneFile.ml	31 Aug 2005 22:51:49 -0000
@@ -429,8 +429,6 @@
           
           set_client_state c (Connected_downloading (file_num file));
           let len64 = Int64.of_int bloc_len in
-          count_download c file len64;
-          network_must_update network;
 
 (* TODO: verify the received data has been requested *)
           
@@ -462,8 +460,8 @@
 (*            List.iter Int64Swarmer.alloc_range c.client_ranges; *)
           let new_downloaded = 
             Int64Swarmer.downloaded swarmer in
-          c.client_downloaded <- c.client_downloaded ++ (
-            new_downloaded -- old_downloaded);
+          count_download c file (new_downloaded -- old_downloaded);
+          network_must_update network;
 (*
           if not (List.mem c.client_ip bb.block_contributors) then
             bb.block_contributors <- c.client_ip :: 
Index: src/utils/net/tcpBufferedSocket.ml
===================================================================
RCS file: /cvsroot/mldonkey/mldonkey/src/utils/net/tcpBufferedSocket.ml,v
retrieving revision 1.32
diff -u -r1.32 tcpBufferedSocket.ml
--- src/utils/net/tcpBufferedSocket.ml	15 Aug 2005 20:23:34 -0000	1.32
+++ src/utils/net/tcpBufferedSocket.ml	31 Aug 2005 22:51:57 -0000
@@ -1689,7 +1689,6 @@
                     let nconnections = maxi bc.nconnections 1 in
                     let can_read = maxi 1 (bc.remaining_bytes / nconnections) in
                     let can_read = maxi !ip_packet_size (can_read * t.read_power) in
-                    let old_nread = t.nread in
                     (try
 (*                    lprintf "allow to read %d\n" can_read; *)
                         can_read_handler t t.sock_in can_read
@@ -1698,8 +1697,6 @@
                             (Printexc2.to_string e)
                           t.name (sock_num t.sock_in) *) ()
                     );
-                    bc.remaining_bytes <- bc.remaining_bytes -
-                    t.nread + old_nread;
                     bc.nconnections <- bc.nconnections - t.read_power
                   else
                   if !verbose_bandwidth > 2 then begin
