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

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

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

revision 1.18 by spiralvoice, Thu Jul 7 00:25:46 2005 UTC revision 1.19 by spiralvoice, Wed Jul 27 20:06:16 2005 UTC
# Line 341  let bt_handler parse_fun handler c sock Line 341  let bt_handler parse_fun handler c sock
341              try              try
342                  handler sock p;                  handler sock p;
343              with e ->              with e ->
344                  lprintf "Exception %s in BTProtocol.parse_fun while handling peer_id\n"                  lprintf_nl "Exception %s in BTProtocol.parse_fun while handling peer_id"
345                      (Printexc2.to_string e);                      (Printexc2.to_string e);
346                  dump payload;                  dump payload;
347                  buf_used b b.len;                  buf_used b b.len;
# Line 359  let bt_handler parse_fun handler c sock Line 359  let bt_handler parse_fun handler c sock
359          if msg_len < 0 then          if msg_len < 0 then
360            begin            begin
361              let (ip,port) = (TcpBufferedSocket.peer_addr sock) in              let (ip,port) = (TcpBufferedSocket.peer_addr sock) in
362              lprintf "BT: Unknown message from %s:%d dropped!! peerid:%b data_len:%i msg_len:%i software: %s\n"              lprintf_nl "BT: Unknown message from %s:%d dropped!! peerid:%b data_len:%i msg_len:%i software: %s"
363                  (Ip.to_string ip) port c.client_received_peer_id b.len msg_len c.client_software;                  (Ip.to_string ip) port c.client_received_peer_id b.len msg_len c.client_software;
364              dump (String.sub b.buf b.pos (min b.len 30));              dump (String.sub b.buf b.pos (min b.len 30));
365              buf_used b b.len;              buf_used b b.len;
# Line 370  let bt_handler parse_fun handler c sock Line 370  let bt_handler parse_fun handler c sock
370               trying to waste our bandwidth ? *)               trying to waste our bandwidth ? *)
371            begin            begin
372              let (ip,port) = (TcpBufferedSocket.peer_addr sock) in              let (ip,port) = (TcpBufferedSocket.peer_addr sock) in
373              lprintf "btprotocol.bt_handler: closed connection from %s:%d because of too much data!! data_len:%i msg_len:%i software: %s\n"              lprintf_nl "btprotocol.bt_handler: closed connection from %s:%d because of too much data!! data_len:%i msg_len:%i software: %s"
374                  (Ip.to_string ip) port b.len msg_len c.client_software;                  (Ip.to_string ip) port b.len msg_len c.client_software;
375              dump (String.sub b.buf b.pos (min b.len 30));              dump (String.sub b.buf b.pos (min b.len 30));
376              buf_used b b.len;              buf_used b b.len;
# Line 394  let bt_handler parse_fun handler c sock Line 394  let bt_handler parse_fun handler c sock
394                      (* lprintf "Parsed, calling handler\n"; *)                      (* lprintf "Parsed, calling handler\n"; *)
395                      handler sock p                      handler sock p
396                  with e ->                  with e ->
397                      lprintf "Exception %s in BTProtocol.parse_fun while handling message with opcode: %d\n"                      lprintf_nl "Exception %s in BTProtocol.parse_fun while handling message with opcode: %d"
398                        (Printexc2.to_string e) opcode;                        (Printexc2.to_string e) opcode;
399                      dump payload;                      dump payload;
400              else              else
# Line 407  let bt_handler parse_fun handler c sock Line 407  let bt_handler parse_fun handler c sock
407    with    with
408      | Wait_for_more s ->      | Wait_for_more s ->
409          if closed sock && s <> "after_peer_id" then          if closed sock && s <> "after_peer_id" then
410              lprintf "bt_handler: Socket was closed while waiting for more data in %s\n" s              lprintf_nl "bt_handler: Socket was closed while waiting for more data in %s" s
411      | e ->      | e ->
412          lprintf "Exception %s in bt_handler\n"          lprintf_nl "Exception %s in bt_handler"
413            (Printexc2.to_string e)            (Printexc2.to_string e)
414    
   
415  let handlers info gconn =  let handlers info gconn =
416    let rec iter_read sock nread =    let rec iter_read sock nread =
417      (* lprintf "iter_read %d\n" nread; *)      (* lprintf "iter_read %d\n" nread; *)
# Line 437  let handlers info gconn = Line 436  let handlers info gconn =
436              end              end
437            else if (TcpBufferedSocket.closed sock) then            else if (TcpBufferedSocket.closed sock) then
438                let (ip,port) = (TcpBufferedSocket.peer_addr sock) in                let (ip,port) = (TcpBufferedSocket.peer_addr sock) in
439                lprintf "bt-handshake: closed sock from %s:%d  b.len:%i slen:%i\n"                lprintf_nl "bt-handshake: closed sock from %s:%d  b.len:%i slen:%i"
440                  (Ip.to_string ip) port b.len slen;                  (Ip.to_string ip) port b.len slen;
441    
442        | Reader h ->        | Reader h ->
443            h gconn sock            h gconn sock
444    in    in
445    iter_read    iter_read
446      
447  let set_bt_sock sock info ghandler =  let set_bt_sock sock info ghandler =
448    let gconn = {    let gconn = {
449        gconn_handler = ghandler;        gconn_handler = ghandler;
# Line 469  let set_bt_sock sock info ghandler = Line 468  let set_bt_sock sock info ghandler =
468                  set_lifetime sock 30.                  set_lifetime sock 30.
469  (*                TcpBufferedSocket.close sock "write done" *)  (*                TcpBufferedSocket.close sock "write done" *)
470            | refill :: _ -> refill sock)            | refill :: _ -> refill sock)
471                  
         
472        
473  (*    (*  
474  No payload:  No payload:
# Line 503  let send_client client_sock msg = Line 501  let send_client client_sock msg =
501        try        try
502          let s = TcpMessages.write msg in          let s = TcpMessages.write msg in
503          if !verbose_msg_clients then begin          if !verbose_msg_clients then begin
504              lprintf "send message: %s\n" (TcpMessages.to_string msg);              lprintf_nl "send message: %s" (TcpMessages.to_string msg);
505            end;            end;
506  (*        dump s; *)  (*        dump s; *)
507          write_string sock s          write_string sock s
508    with e ->    with e ->
509        lprintf "CLIENT : Error %s in send_client\n"        lprintf_nl "CLIENT : Error %s in send_client"
510          (Printexc2.to_string e)          (Printexc2.to_string e)
511  )  )
512    

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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