/[mldonkey]/mldonkey/src/utils/net/tcpBufferedSocket.ml
ViewVC logotype

Diff of /mldonkey/src/utils/net/tcpBufferedSocket.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35 by spiralvoice, Mon Sep 19 10:09:06 2005 UTC revision 1.36 by spiralvoice, Sun Oct 16 20:42:55 2005 UTC
# Line 553  let write t s pos1 len = Line 553  let write t s pos1 len =
553  (*          if t.monitored then begin  (*          if t.monitored then begin
554                lprintf "write: direct written %d\n" nw;                lprintf "write: direct written %d\n" nw;
555  end; *)  end; *)
556            tcp_uploaded_bytes := Int64.add !tcp_uploaded_bytes (Int64.of_int nw);            tcp_uploaded_bytes := !tcp_uploaded_bytes ++ (Int64.of_int nw);
557            (match t.write_control with            (match t.write_control with
558                None -> ()                None -> ()
559              | Some bc ->              | Some bc ->
560                  bc.moved_bytes <-                  bc.moved_bytes <- bc.moved_bytes ++ (Int64.of_int nw));
                   Int64.add bc.moved_bytes (Int64.of_int nw));  
561            if t.nwrite = 0 then begin            if t.nwrite = 0 then begin
562  (*              if t.connecting then  (*              if t.connecting then
563                  lprintf "WRITE BEFORE CONNECTION.......\n";                  lprintf "WRITE BEFORE CONNECTION.......\n";
# Line 698  let can_read_handler t sock max_len = Line 697  let can_read_handler t sock max_len =
697      end;      end;
698  *)  *)
699    
700      tcp_downloaded_bytes := Int64.add !tcp_downloaded_bytes (Int64.of_int nread);      tcp_downloaded_bytes := !tcp_downloaded_bytes ++ (Int64.of_int nread);
701      (match t.read_control with      (match t.read_control with
702          None -> () | Some bc ->          None -> () | Some bc ->
703            bc.moved_bytes <-            bc.moved_bytes <- bc.moved_bytes ++ (Int64.of_int nread));
           Int64.add bc.moved_bytes (Int64.of_int nread));  
704    
705      t.nread <- t.nread + nread;      t.nread <- t.nread + nread;
706      if nread > 0 then begin      if nread > 0 then begin
# Line 755  let can_write_handler t sock max_len = Line 753  let can_write_handler t sock max_len =
753    
754  (*            if t.monitored then  (*            if t.monitored then
755  (lprintf "written %d\n" nw; ); *)  (lprintf "written %d\n" nw; ); *)
756          tcp_uploaded_bytes := Int64.add !tcp_uploaded_bytes (Int64.of_int nw);          tcp_uploaded_bytes := !tcp_uploaded_bytes ++ (Int64.of_int nw);
757          (match t.write_control with          (match t.write_control with
758              None -> ()              None -> ()
759            | Some bc ->            | Some bc ->
760                bc.moved_bytes <-                bc.moved_bytes <- bc.moved_bytes ++ (Int64.of_int nw));
                     Int64.add bc.moved_bytes (Int64.of_int nw));  
761              if t.nwrite = 0 then begin              if t.nwrite = 0 then begin
762  (*                lprintf "add_connect_latency at %f\n" (current_time ()); *)  (*                lprintf "add_connect_latency at %f\n" (current_time ()); *)
763                  add_connect_latency t.host t.connect_time;                  add_connect_latency t.host t.connect_time;
# Line 960  let compute_lost_byte bc = Line 957  let compute_lost_byte bc =
957    if bc.total_bytes = 0 then -1 else    if bc.total_bytes = 0 then -1 else
958    let sum = ref Int64.zero in    let sum = ref Int64.zero in
959    for i = 0 to 3600-1 do    for i = 0 to 3600-1 do
960      sum := Int64.add !sum (Int64.of_int bc.lost_bytes.(i));      sum := !sum ++ (Int64.of_int bc.lost_bytes.(i));
961    done;    done;
962    Int64.to_int (Int64.div !sum (Int64.of_int 3600))    Int64.to_int (!sum // 3600L)
963    
964  let moved_bytes bc = bc.moved_bytes  let moved_bytes bc = bc.moved_bytes
965    

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26