/[mldonkey]/mldonkey/src/networks/bittorrent/bTClients.ml
ViewVC logotype

Diff of /mldonkey/src/networks/bittorrent/bTClients.ml

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

revision 1.45 by spiralvoice, Sun Aug 7 12:57:21 2005 UTC revision 1.46 by spiralvoice, Tue Aug 9 10:52:58 2005 UTC
# Line 860  and client_to_client c sock msg = Line 860  and client_to_client c sock msg =
860                        (AvailableCharBitmap bitmap));                        (AvailableCharBitmap bitmap));
861                c.client_registered_bitfield <- true;                c.client_registered_bitfield <- true;
862                c.client_bitmap <- Some bitmap;                c.client_bitmap <- Some bitmap;
863                send_interested c;                (* send interested if we are *)
864                  if c.client_interesting then
865                    send_interested c;
866                if !verbose_msg_clients then                if !verbose_msg_clients then
867                  lprintf_nl () "New BitField Registered";                  lprintf_nl () "New BitField Registered";
868  (*        for i = 1 to max_range_requests - List.length c.client_ranges do  (*        for i = 1 to max_range_requests - List.length c.client_ranges do
869            (try get_from_client sock c with _ -> ())            (try get_from_client sock c with _ -> ())
870          done*)          done*)
871          end;          end;
872          (*a bitfield must only be sent after the handshake and before everything else: NOT here          (* Note: a bitfield must only be sent after the handshake and before everything else: NOT here *)
           if c.client_incoming then send_bitfield c;  
         *)  
873    
874      | Have n ->      | Have n ->
875  (*A client can send a "Have" without sending a Bitfield*)          (* A client can send a "Have" without sending a Bitfield *)
876          begin          begin
877            match c.client_file.file_swarmer with            match c.client_file.file_swarmer with
878              None -> ()              None -> ()
# Line 985  and client_to_client c sock msg = Line 985  and client_to_client c sock msg =
985            end;            end;
986    
987      | Ping -> ()      | Ping -> ()
988          (*We don't 'generate' a Ping message on a Ping.*)          (* We don't 'generate' a Ping message on a Ping. *)
989    
990        | Cancel (n, pos, len) ->
991            (* if we receive a cancel message from a peer, remove request *)
992            if client_has_a_slot (as_client c) then
993              c.client_upload_requests <- List2.remove_first (n, pos, len) c.client_upload_requests
994            else
995              if !verbose_msg_clients then
996                lprintf_nl () "Error: received cancel request but client has no slot"
997    
     | Cancel _ -> ()  
998    with e ->    with e ->
999        lprintf_nl () "Error %s while handling MESSAGE: %s" (Printexc2.to_string e) (TcpMessages.to_string msg)        lprintf_nl () "Error %s while handling MESSAGE: %s" (Printexc2.to_string e) (TcpMessages.to_string msg)
1000    
# Line 1422  let rec iter_upload sock c = Line 1429  let rec iter_upload sock c =
1429  (*          lprintf "Unix32.read: offset %Ld len %d\n" offset len; *)  (*          lprintf "Unix32.read: offset %Ld len %d\n" offset len; *)
1430            Unix32.read (file_fd file) offset upload_buffer 0 len;            Unix32.read (file_fd file) offset upload_buffer 0 len;
1431           (* update upload rate from len bytes *)           (* update upload rate from len bytes *)
1432            Rate.update c.client_upload_rate  (float_of_int len);            Rate.update c.client_upload_rate  (float_of_int (len / 2));
1433            file.file_uploaded <- file.file_uploaded ++ (Int64.of_int len);            file.file_uploaded <- file.file_uploaded ++ (Int64.of_int len);
1434            let _ =            let _ =
1435              (* update stats *)              (* update stats *)

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

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