[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/tcpBuf...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/tcpBuf... |
Date: |
Tue, 31 Oct 2006 15:41:55 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 06/10/31 15:41:55
Modified files:
distrib : ChangeLog
src/utils/net : tcpBufferedSocket.ml tcpBufferedSocket.mli
tcpClientSocket.ml udpSocket.ml
Log message:
patch #5486
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1073&r2=1.1074
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/tcpBufferedSocket.ml?cvsroot=mldonkey&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/tcpBufferedSocket.mli?cvsroot=mldonkey&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/tcpClientSocket.ml?cvsroot=mldonkey&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/udpSocket.ml?cvsroot=mldonkey&r1=1.20&r2=1.21
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1073
retrieving revision 1.1074
diff -u -b -r1.1073 -r1.1074
--- distrib/ChangeLog 31 Oct 2006 15:40:05 -0000 1.1073
+++ distrib/ChangeLog 31 Oct 2006 15:41:55 -0000 1.1074
@@ -15,6 +15,7 @@
=========
2006/10/31
+5486: UDP bandwidth monitor fix (bogeyman)
5505: EDK: Support aMule/Hydranode style OS_INFO tag
2006/10/30
Index: src/utils/net/tcpBufferedSocket.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/tcpBufferedSocket.ml,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- src/utils/net/tcpBufferedSocket.ml 3 Apr 2006 20:50:09 -0000 1.43
+++ src/utils/net/tcpBufferedSocket.ml 31 Oct 2006 15:41:55 -0000 1.44
@@ -805,13 +805,10 @@
if bc.total_bytes = 0 then
can_write_handler t sock t.wbuf.len
else begin
-(* lprintf "DELAYED\n"; *)
- if bc.remaining_bytes > 0 then begin
bc.connections <- t :: bc.connections;
bc.nconnections <- t.write_power + bc.nconnections
end
end
- end
let get_latencies verbose =
let b = Buffer.create 300 in
Index: src/utils/net/tcpBufferedSocket.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/tcpBufferedSocket.mli,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/utils/net/tcpBufferedSocket.mli 28 Jun 2005 22:45:57 -0000 1.15
+++ src/utils/net/tcpBufferedSocket.mli 31 Oct 2006 15:41:55 -0000 1.16
@@ -79,6 +79,9 @@
val set_max_output_buffer : t -> int -> unit
val can_write : t -> bool
val can_write_len : t -> int -> bool
+val register_download : t -> int -> unit
+val register_upload : t -> int -> unit
+val register_bytes : bandwidth_controler option -> int -> unit
val set_monitored : t -> bool -> unit
val monitored : t -> bool
Index: src/utils/net/tcpClientSocket.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/tcpClientSocket.ml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/utils/net/tcpClientSocket.ml 6 Dec 2005 20:26:40 -0000 1.12
+++ src/utils/net/tcpClientSocket.ml 31 Oct 2006 15:41:55 -0000 1.13
@@ -527,7 +527,7 @@
set_allow_write t.sock bc.allow_io;
bandwidth_controler t t.sock
-let max_buffer_size = ref 1000000
+let max_buffer_size = ref 10000000
let dump_socket t buf =
print_socket buf t.sock;
Index: src/utils/net/udpSocket.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/udpSocket.ml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- src/utils/net/udpSocket.ml 14 Dec 2005 21:17:47 -0000 1.20
+++ src/utils/net/udpSocket.ml 31 Oct 2006 15:41:55 -0000 1.21
@@ -23,6 +23,14 @@
open AnyEndian
open LittleEndian
+let log_prefix = "[udpSock]"
+
+let lprintf_nl fmt =
+ lprintf_nl2 log_prefix fmt
+
+let lprintf_n fmt =
+ lprintf2 log_prefix fmt
+
type event =
WRITE_DONE
| CAN_REFILL
@@ -131,6 +139,7 @@
mutable allow_io : bool ref;
mutable count : int;
mutable base_time : int;
+ mutable tcp_bc : TcpBufferedSocket.bandwidth_controler;
}
and handler = t -> event -> unit
@@ -190,10 +199,10 @@
lprintf_nl "ADDR_UNIX (%s)" s;
end
-let max_delayed_send = 30
+let max_delayed_send = 1
let write t ping s ip port =
-(* lprintf "UDP write to %s:%d\n" (Ip.to_string ip) port; *)
+(* lprintf_nl "UDP write to %s:%d" (Ip.to_string ip) port; *)
if not (closed t) && t.wlist_size < !max_wlist_size then
let s, addr = match t.socks_local with
None -> s, Unix.ADDR_INET(Ip.to_inet_addr ip, port)
@@ -219,16 +228,19 @@
let _ =
try
if ping then declare_ping ip;
- ignore(Unix.sendto (fd sock) s 0 len [] addr)
+ ignore(Unix.sendto (fd sock) s 0 len [] addr);
+ if !verbose_bandwidth > 1 then begin
+ lprintf_nl "[BW2] direct send udp %d bytes (write)" len;
+ end;
with e ->
- lprintf "Exception in sendto %s:%d\n" (Ip.to_string ip)
port;
+ lprintf_nl "Exception in sendto %s:%d" (Ip.to_string ip)
port;
raise e
in
udp_uploaded_bytes := !udp_uploaded_bytes ++ (Int64.of_int len);
()
(*
-lprintf "UDP sent [%s]" (String.escaped
-(String.sub s pos len)); lprint_newline ();
+lprintf_nl "UDP sent [%s]" (String.escaped
+(String.sub s pos len));
*)
with
Unix.Unix_error ((Unix.EWOULDBLOCK | Unix.ENOBUFS), _, _) ->
@@ -240,7 +252,7 @@
t.wlist_size <- t.wlist_size + String.length s;
must_write sock true;
| e ->
- lprintf "Exception %s in sendto\n"
+ lprintf_nl "Exception %s in sendto"
(Printexc2.to_string e);
print_addr addr;
raise e
@@ -265,6 +277,10 @@
t.wlist_size <- t.wlist_size + String.length s;
must_write t.sock true;
end
+ else
+ if !debug then begin
+ lprintf_nl "UDP DROPPED in write";
+ end
let dummy_sock = Obj.magic 0
@@ -278,11 +294,16 @@
begin try
ignore (local_sendto (fd sock) p);
udp_uploaded_bytes := !udp_uploaded_bytes ++ (Int64.of_int len);
+ if !verbose_bandwidth > 1 then begin
+ lprintf_nl "[BW2] direct send udp %d bytes (iter_write_no_bc)" len;
+ end
with
- Unix.Unix_error ((Unix.EWOULDBLOCK | Unix.ENOBUFS), _, _) as e -> raise e
+ Unix.Unix_error ((Unix.EWOULDBLOCK | Unix.ENOBUFS), _, _) as e ->
+ lprintf_nl "Exception %s in sendto next" (Printexc2.to_string e);
+ raise e
| e ->
if !debug then
- lprintf "Exception %s in sendto next\n"
+ lprintf_nl "Exception %s in sendto next"
(Printexc2.to_string e)
end;
iter_write_no_bc t sock
@@ -302,23 +323,27 @@
t.wlist_size <- t.wlist_size - String.length p.udp_content;
if time < bc.base_time then begin
if !debug then begin
- lprintf "[UDP DROPPED]";
+ lprintf_nl "UDP DROPPED in iter_write";
end;
iter_write t sock bc
end else
let len = String.length p.udp_content in
begin try
-
-
ignore (local_sendto (fd sock) p);
udp_uploaded_bytes := !udp_uploaded_bytes ++ (Int64.of_int len);
bc.remaining_bytes <- bc.remaining_bytes - (len +
!TcpBufferedSocket.ip_packet_size) ;
+ TcpBufferedSocket.register_bytes (Some bc.tcp_bc) len;
+ if !verbose_bandwidth > 1 then begin
+ lprintf_nl "[BW2] bc send udp %d bytes" len;
+ end;
with
- Unix.Unix_error ((Unix.EWOULDBLOCK | Unix.ENOBUFS), _, _) as e ->
raise e
+ Unix.Unix_error ((Unix.EWOULDBLOCK | Unix.ENOBUFS), _, _) as e ->
+ lprintf_nl "Exception %s in sendto next" (Printexc2.to_string e);
+ raise e
| e ->
if !debug then
- lprintf "Exception %s in sendto next\n"
+ lprintf_nl "Exception %s in sendto next"
(Printexc2.to_string e)
end;
iter_write t sock bc
@@ -418,26 +443,28 @@
allow_io = ref false;
count = 0;
base_time = 0;
+ tcp_bc = tcp_bc;
} in
let udp_user total n =
-(*
- if !BasicSocket.debug then begin
- lprintf "udp_user %d/%d" n total; lprint_newline ();
- end; *)
+ if !verbose_bandwidth > 0 then
+ lprintf_nl "udp_user %d/%d" n total;
let n = if total = 0 then 100000 else n in
udp_bc.base_time <- udp_bc.base_time + 1;
if udp_bc.count = 0 then begin
udp_bc.count <- 10;
TcpBufferedSocket.set_lost_bytes tcp_bc udp_bc.remaining_bytes
udp_bc.base_time;
- udp_bc.remaining_bytes <- 0;
end;
udp_bc.count <- udp_bc.count - 1;
udp_bc.total_bytes <- total;
- udp_bc.remaining_bytes <- udp_bc.remaining_bytes + n;
+ udp_bc.remaining_bytes <- total / 2;
+(* udp_bc.remaining_bytes <- udp_bc.remaining_bytes + n; *)
if total <> 0 && udp_bc.remaining_bytes > total then
udp_bc.remaining_bytes <- total;
udp_bc.allow_io := udp_bc.remaining_bytes > 0;
+ if !verbose_bandwidth > 0 then
+ lprintf_nl "udp_bc count:%d total_bytes:%d remaining_bytes:%d"
+ udp_bc.count udp_bc.total_bytes udp_bc.remaining_bytes;
in
TcpBufferedSocket.set_remaining_bytes_user tcp_bc udp_user;
udp_bc
@@ -510,8 +537,8 @@
MlUnix.set_nonblock fd;
with e ->
- lprintf "[SOCKS] proxy error prevent creation of UDP socket: %s"
- (Printexc2.to_string e); lprint_newline ();
+ lprintf_nl "[SOCKS] proxy error prevent creation of UDP socket: %s"
+ (Printexc2.to_string e);
close t "socks proxy error"; raise e
*)
@@ -524,7 +551,7 @@
) latencies;
LittleEndian.buf_int b !counter;
Hashtbl.iter (fun ip (latency, samples) ->
- if !verbose then lprintf " Latency UDP: %s -> %d (%d samples)\n"
(Ip.to_string ip) !latency !samples;
+ if !verbose then lprintf_nl " Latency UDP: %s -> %d (%d samples)"
(Ip.to_string ip) !latency !samples;
LittleEndian.buf_ip b ip;
LittleEndian.buf_int16 b !latency;
LittleEndian.buf_int16 b !samples;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/net/tcpBuf...,
mldonkey-commits <=