/[mldonkey]/mldonkey/src/networks/donkey/donkeyProtoOvernet.ml
ViewVC logotype

Diff of /mldonkey/src/networks/donkey/donkeyProtoOvernet.ml

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

revision 1.15 by spiralvoice, Tue Jun 28 23:17:07 2005 UTC revision 1.16 by spiralvoice, Thu Jul 7 00:25:46 2005 UTC
# Line 185  module Proto = struct Line 185  module Proto = struct
185              Field_UNKNOWN "loc" ->              Field_UNKNOWN "loc" ->
186                for_string_tag tag (fun bcp ->                for_string_tag tag (fun bcp ->
187                    if !verbose_overnet then                    if !verbose_overnet then
188                    lprintf "loc tag : [%s]\n" bcp;                    lprintf_nl "loc tag : [%s]" bcp;
189                    if String2.starts_with bcp "bcp://" then                    if String2.starts_with bcp "bcp://" then
190                      let bcp2 = String.sub bcp 6 (String.length bcp - 6)                      let bcp2 = String.sub bcp 6 (String.length bcp - 6)
191                      in                      in
192                      match String2.split_simplify bcp2 ':' with                      match String2.split_simplify bcp2 ':' with
193                      | [_;ip;port] ->                      | [_;ip;port] ->
194                          if !verbose_overnet then                          if !verbose_overnet then
195                            lprintf "FIXME: Received BCP type 2 %s\n"                            lprintf_nl "FIXME: Received BCP type 2 %s"
196                              bcp;                              bcp;
197    
198  (* FIXME: A firewalled peer...  (* FIXME: A firewalled peer...
# Line 205  module Proto = struct Line 205  module Proto = struct
205                          peer_tcpport := int_of_string port;                          peer_tcpport := int_of_string port;
206                      | _ ->                      | _ ->
207                          if !verbose_overnet then                          if !verbose_overnet then
208                            lprintf "Ill formed bcp: [%s]\n" bcp;                            lprintf_nl "Ill formed bcp: [%s]" bcp;
209                    else                    else
210                      if !verbose_overnet then                      if !verbose_overnet then
211                        lprintf "Ill formed bcp: [%s]\n" bcp;                        lprintf "Ill formed bcp: [%s]" bcp;
212                )                )
213            | _ ->            | _ ->
214              if !verbose_overnet then              if !verbose_overnet then
215                lprintf "Unused source tag [%s]\n"                lprintf_nl "Unused source tag [%s]"
216                  (escaped_string_of_field tag)                  (escaped_string_of_field tag)
217        ) r_tags;        ) r_tags;
218        {        {
# Line 321  module Proto = struct Line 321  module Proto = struct
321          | 21 ->          | 21 ->
322  (* idem as 33, but IP seem to be a low ID *)  (* idem as 33, but IP seem to be a low ID *)
323              if !verbose_overnet then begin              if !verbose_overnet then begin
324                  lprintf "Received code %d message.\nDump: " opcode; dump s; lprint_newline ();                  lprintf_nl "Received code %d message.\nDump:" opcode;
325                    dump s;
326                    lprintf_nl "";
327                end;                end;
328                            
329              let peer, _ = get_peer s 0 in              let peer, _ = get_peer s 0 in
# Line 329  module Proto = struct Line 331  module Proto = struct
331                    
332          | 24 ->          | 24 ->
333              if !verbose_overnet then              if !verbose_overnet then
334                lprintf "RCVD: OVERNET FIREWALL CONNECTION (24)\n";                lprintf_nl "RCVD: OVERNET FIREWALL CONNECTION (24)";
335              let md4 = get_md4 s 0 in              let md4 = get_md4 s 0 in
336              let port = get_int16 s 16 in              let port = get_int16 s 16 in
337              OvernetFirewallConnection(md4,port)              OvernetFirewallConnection(md4,port)
338                    
339          | 25 ->          | 25 ->
340              if !verbose_overnet then              if !verbose_overnet then
341                lprintf "RCVD: OVERNET FIREWALL CONNECTION ACK (25)\n";                lprintf_nl "RCVD: OVERNET FIREWALL CONNECTION ACK (25)";
342              let md4 = get_md4 s 0 in              let md4 = get_md4 s 0 in
343              OvernetFirewallConnectionACK(md4)              OvernetFirewallConnectionACK(md4)
344                    
345          | 26 ->          | 26 ->
346              if !verbose_overnet then              if !verbose_overnet then
347                lprintf "RCVD: OVERNET FIREWALL CONNECTION NACK (26)\n";                lprintf_nl "RCVD: OVERNET FIREWALL CONNECTION NACK (26)";
348              let md4 = get_md4 s 0 in              let md4 = get_md4 s 0 in
349              OvernetFirewallConnectionNACK(md4)              OvernetFirewallConnectionNACK(md4)
350                    
351          | 27 ->          | 27 ->
352              if !verbose_overnet then              if !verbose_overnet then
353                lprintf "RCVD: GETMYIP MESSAGE (27)\n";                lprintf_nl "RCVD: GETMYIP MESSAGE (27)";
354              OvernetGetMyIP (get_int16 s 0)              OvernetGetMyIP (get_int16 s 0)
355          | 28 ->          | 28 ->
356              if !verbose_overnet then              if !verbose_overnet then
357                lprintf "RCVD: GETMYIPRESULT MESSAGE (28)\n";                lprintf_nl "RCVD: GETMYIPRESULT MESSAGE (28)";
358              let ip = get_ip s 0 in              let ip = get_ip s 0 in
359              OvernetGetMyIPResult (ip)              OvernetGetMyIPResult (ip)
360          | 29 ->          | 29 ->
361              if !verbose_overnet then              if !verbose_overnet then
362                lprintf "RCVD: GETMYIPDONE MESSAGE (29)\n";                lprintf_nl "RCVD: GETMYIPDONE MESSAGE (29)";
363              OvernetGetMyIPDone              OvernetGetMyIPDone
364                    
365          | 33 ->          | 33 ->
366              if !verbose_overnet then              if !verbose_overnet then
367                lprintf "RCVD: PEER NOT FOUND (33)\n";                lprintf_nl "RCVD: PEER NOT FOUND (33)";
368              let peer, _ = get_peer s 0 in              let peer, _ = get_peer s 0 in
369              OvernetPeerNotFound peer              OvernetPeerNotFound peer
370                    
371          | _ ->          | _ ->
372              if !verbose_unknown_messages then              if !verbose_unknown_messages then
373                begin                begin
374                  lprintf "UNKNOWN: opcode %d\n" opcode;                  lprintf_nl "UNKNOWN: opcode %d" opcode;
375                  dump s;                  dump s;
376                  lprint_newline ();                  lprintf_nl "";
377                end;                end;
378              OvernetUnknown (opcode, s)              OvernetUnknown (opcode, s)
379        with e ->        with e ->
380            if !verbose_hidden_errors then            if !verbose_hidden_errors then
381              begin              begin
382                lprintf "Error %s while parsing opcode %d\n" (Printexc2.to_string e) opcode;                lprintf_nl "Error %s while parsing opcode %d" (Printexc2.to_string e) opcode;
383                dump s;                dump s;
384                lprint_newline ();                lprintf_nl "";
385              end;              end;
386            OvernetUnknown (opcode, s)            OvernetUnknown (opcode, s)
387            
# Line 394  module Proto = struct Line 396  module Proto = struct
396                    int_of_char pbuf.[0] <> 227 then                    int_of_char pbuf.[0] <> 227 then
397                    begin                    begin
398                      if !verbose_unknown_messages then begin                      if !verbose_unknown_messages then begin
399                          lprintf "Received unknown UDP packet\n";                          lprintf_nl "Received unknown UDP packet";
400                          dump pbuf;                          dump pbuf;
401                        end                        end
402                    end                    end
# Line 412  module Proto = struct Line 414  module Proto = struct
414                    end                    end
415                with e ->                with e ->
416                  if !verbose_hidden_errors then begin                  if !verbose_hidden_errors then begin
417                    lprintf "Error %s in udp_handler, dump of packet:\n"                    lprintf_nl "Error %s in udp_handler, dump of packet:"
418                      (Printexc2.to_string e);                      (Printexc2.to_string e);
419                    dump p.UdpSocket.udp_content;                    dump p.UdpSocket.udp_content;
420                    lprint_newline ()                    lprintf_nl ""
421                  end                  end
422            );            );
423        | _ -> ()        | _ -> ()
# Line 436  module Proto = struct Line 438  module Proto = struct
438          let s = Buffer.contents udp_buf in          let s = Buffer.contents udp_buf in
439          if !verbose_overnet then          if !verbose_overnet then
440            begin                        begin            
441              lprintf "Sending UDP to %s:%d (0x%02X)\n"              lprintf_nl "Sending UDP to %s:%d (0x%02X)"
442                (Ip.to_string ip) port (get_uint8 s 1);                (Ip.to_string ip) port (get_uint8 s 1);
443              lprintf "  %s\n"  (message_to_string msg)              lprintf_nl "  %s"  (message_to_string msg)
444  (*dump s; lprint_newline ();*)  (*dump s; lprint_newline ();*)
445            end;            end;
446          let len = String.length s in          let len = String.length s in
447          UdpSocket.write sock ping s ip port          UdpSocket.write sock ping s ip port
448        with e ->        with e ->
449            lprintf "Exception %s in udp_send\n" (Printexc2.to_string e)            lprintf_nl "Exception %s in udp_send" (Printexc2.to_string e)
450    
451      let udp_send sock ip port ping msg =      let udp_send sock ip port ping msg =
452        match msg with        match msg with
# Line 516  module Overnet = struct Line 518  module Overnet = struct
518              assert (port = !!overnet_port)              assert (port = !!overnet_port)
519          | _ -> failwith "Bad socket address"          | _ -> failwith "Bad socket address"
520        with e ->        with e ->
521            lprintf "Could not affect a TCP port %d for Overnet\n" !!overnet_port;            lprintf_nl "Could not assign TCP port %d for Overnet\n" !!overnet_port;
522            tcp_sock := None            tcp_sock := None
523            
524      let disable () =      let disable () =

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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