[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr... |
Date: |
Sun, 11 Mar 2007 16:09:29 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 07/03/11 16:09:29
Modified files:
distrib : ChangeLog
src/networks/bittorrent: bTChooser.ml bTClients.ml bTRate.ml
Log message:
patch #5774
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1200&r2=1.1201
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTChooser.ml?cvsroot=mldonkey&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTClients.ml?cvsroot=mldonkey&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTRate.ml?cvsroot=mldonkey&r1=1.3&r2=1.4
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1200
retrieving revision 1.1201
diff -u -b -r1.1200 -r1.1201
--- distrib/ChangeLog 11 Mar 2007 16:08:25 -0000 1.1200
+++ distrib/ChangeLog 11 Mar 2007 16:09:29 -0000 1.1201
@@ -15,6 +15,7 @@
=========
2007/03/11
+5774: BT: fix upload managment (orbit)
5786: HTML: small javascript search improve (orbit)
2007/03/08
Index: src/networks/bittorrent/bTChooser.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTChooser.ml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/networks/bittorrent/bTChooser.ml 19 May 2006 23:43:54 -0000
1.12
+++ src/networks/bittorrent/bTChooser.ml 11 Mar 2007 16:09:29 -0000
1.13
@@ -69,7 +69,7 @@
max_list:= to_add;
(* clients in optim are current optimistic uploaders (30 seconds) *)
let optim,notoptim = List.partition ( fun a ->
- (Rate.ratesince a.client_upload_rate) > 0.
+ (Rate.ratesince a.client_upload_rate) > 0
&& a.client_last_optimist + 30 > last_time()
) next in
let notoptim = List.sort (fun a b -> compare a.client_last_optimist
b.client_last_optimist) notoptim in
Index: src/networks/bittorrent/bTClients.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTClients.ml,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- src/networks/bittorrent/bTClients.ml 18 Feb 2007 00:13:08 -0000
1.86
+++ src/networks/bittorrent/bTClients.ml 11 Mar 2007 16:09:29 -0000
1.87
@@ -844,7 +844,7 @@
(*Update rate and amount of data received from client*)
count_download c (new_downloaded -- old_downloaded);
(* use len here with max_dr quickfix *)
- Rate.update c.client_downloaded_rate (float_of_int len);
+ Rate.update c.client_downloaded_rate ~amount:len;
if !verbose_msg_clients then
(match c.client_ranges_sent with
[] -> lprintf_file_nl (as_file file) "EMPTY Ranges !!!"
@@ -869,16 +869,6 @@
c.client_ranges_sent <- tail;
end;
get_from_client sock c;
- if (List.length !current_uploaders < (!!max_bt_uploaders-1)) &&
- (List.mem c (!current_uploaders)) == false && c.client_interested
then
- begin
- (*we are probably an optimistic uploaders for this client
- don't miss the oportunity if we can
- *)
- current_uploaders := c::(!current_uploaders);
- c.client_sent_choke <- false;
- start_upload c
- end;
(* Check if the client is still interesting for us... *)
check_if_interesting file c
@@ -891,25 +881,9 @@
let brand, release = parse_software p in
c.client_brand <- brand;
c.client_release <- release;
-(* TODO : enable it
- c.client_release <- (parse_release p c.client_brand);
- *)
-
- if (List.length !current_uploaders < (!!max_bt_uploaders-1)) &&
- (List.mem c (!current_uploaders)) == false then
- begin
- (*we are probably an optimistic uploader for this client
- don't miss the opportunity if we can *)
- current_uploaders := c::(!current_uploaders);
- c.client_sent_choke <- false;
- start_upload c
- end
- else
- begin
send_client c Choke;
c.client_sent_choke <- true;
end
- end
else
disconnect_client c Closed_by_user
@@ -1519,7 +1493,8 @@
(* 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 *)
- Rate.update c.client_upload_rate (float_of_int len);
+ Rate.update c.client_upload_rate ~amount:len;
+ Rate.update c.client_downloaded_rate;
file.file_uploaded <- file.file_uploaded ++ (Int64.of_int len);
let _ =
(* update stats *)
Index: src/networks/bittorrent/bTRate.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTRate.ml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/networks/bittorrent/bTRate.ml 7 Aug 2005 12:57:22 -0000 1.3
+++ src/networks/bittorrent/bTRate.ml 11 Mar 2007 16:09:29 -0000 1.4
@@ -24,49 +24,41 @@
module Rate = struct
type t = {
- mutable ratesince : float;
- mutable lasttime : float;
- mutable rate : float;
+ mutable ratesince : int;
+ mutable lasttime : int;
+ mutable rate : int;
}
-let (>) a b = a.rate > b.rate
-
-let update r amount =
- let t = float_of_int (last_time ()) in
- r.rate <- (r.rate *. (r.lasttime -. r.ratesince) +.
- amount) /. (t -. r.ratesince);
+let update ?(amount=0) r =
+ let t = last_time () in
+ try
+ r.rate <- (r.rate * (r.lasttime - r.ratesince) + amount) / (t -
r.ratesince)
+ with Division_by_zero ->
+ r.rate <- 0;
r.lasttime <- t;
- if r.ratesince < (t -. 20.) then
- r.ratesince <- (t -. 20.)
+ if r.ratesince < (t - 20) then
+ r.ratesince <- (t - 20)
let update_no_change r =
- let t = float_of_int (last_time ()) in
- r.ratesince <- t
+ let t = last_time () in
+ r.ratesince <- t;
+ r.lasttime <- t
let ratesince r =
r.ratesince
let new_rate () =
- let t = float_of_int (last_time()) in
+ let t = last_time() in
{
- ratesince = t -. 1.;
+ ratesince = t - 1;
lasttime = t;
- rate = 0.;
+ rate = 0;
}
-let last_time t =
- t.lasttime
-
let get_rate r =
r.rate
let compare r1 r2 =
compare r1.rate r2.rate
-let zero = {
- ratesince = 0.;
- lasttime = 0.;
- rate = 0.;
- }
-
end
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...,
mldonkey-commits <=