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

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

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

revision 1.16 by spiralvoice, Mon May 2 12:57:59 2005 UTC revision 1.17 by spiralvoice, Mon Jun 20 18:38:49 2005 UTC
# Line 123  let client_handler2 c ff f = Line 123  let client_handler2 c ff f =
123    let msgs = ref 0 in    let msgs = ref 0 in
124    fun sock nread ->    fun sock nread ->
125    
126      if !verbose then begin      if !verbose then lprintf "between clients %d\n" nread;
         lprintf "between clients %d" nread;  
         lprint_newline ();  
       end;  
127      let module M= DonkeyProtoClient in      let module M= DonkeyProtoClient in
128      let b = TcpBufferedSocket.buf sock in      let b = TcpBufferedSocket.buf sock in
129      try      try
# Line 135  let client_handler2 c ff f = Line 132  let client_handler2 c ff f =
132          let msg_len = get_int b.buf (b.pos+1) in          let msg_len = get_int b.buf (b.pos+1) in
133          if b.len >= 5 + msg_len then          if b.len >= 5 + msg_len then
134            begin            begin
135              if !verbose then begin              if !verbose then lprintf "client_to_client\n";
                 lprintf "client_to_client";  
                 lprint_newline ();  
               end;  
136              let s = String.sub b.buf (b.pos+5) msg_len in              let s = String.sub b.buf (b.pos+5) msg_len in
137              buf_used b  (msg_len + 5);              buf_used b  (msg_len + 5);
138              let t = M.parse emule_version opcode s in              let t = M.parse emule_version opcode s in
# Line 155  lprint_newline (); *) Line 149  lprint_newline (); *)
149      with Not_found -> ()      with Not_found -> ()
150        
151  let cut_messages parse f sock nread =  let cut_messages parse f sock nread =
152    if !verbose then begin    if !verbose then lprintf "server to client %d\n" nread;
       lprintf "server to client %d" nread;  
       lprint_newline ();  
     end;  
   
153    let b = TcpBufferedSocket.buf sock in    let b = TcpBufferedSocket.buf sock in
154    try    try
155      while b.len >= 5 do      while b.len >= 5 do
# Line 167  let cut_messages parse f sock nread = Line 157  let cut_messages parse f sock nread =
157        let msg_len = get_int b.buf (b.pos+1) in        let msg_len = get_int b.buf (b.pos+1) in
158        if b.len >= 5 + msg_len then        if b.len >= 5 + msg_len then
159          begin          begin
160            if !verbose then begin            if !verbose then lprintf "server_to_client\n";
               lprintf "server_to_client";  
               lprint_newline ();  
             end;  
161            let s = String.sub b.buf (b.pos+5) msg_len in            let s = String.sub b.buf (b.pos+5) msg_len in
162            buf_used b (msg_len + 5);            buf_used b (msg_len + 5);
163            let t = parse opcode s in            let t = parse opcode s in
# Line 193  let udp_send t ip port msg = Line 180  let udp_send t ip port msg =
180      let s = Buffer.contents buf in      let s = Buffer.contents buf in
181      UdpSocket.write t false s ip port      UdpSocket.write t false s ip port
182    with e ->    with e ->
183        lprintf "Exception %s in udp_send" (Printexc2.to_string e);        lprintf "Exception %s in udp_send\n" (Printexc2.to_string e)
       lprint_newline ()  
184                
185  let udp_handler f sock event =  let udp_handler f sock event =
186    let module M = DonkeyProtoUdp in    let module M = DonkeyProtoUdp in
# Line 223  let udp_basic_handler f sock event = Line 209  let udp_basic_handler f sock event =
209              if len = 0 ||              if len = 0 ||
210                int_of_char pbuf.[0] <> DonkeyOpenProtocol.udp_magic then begin                int_of_char pbuf.[0] <> DonkeyOpenProtocol.udp_magic then begin
211                  if !verbose_unknown_messages then begin                  if !verbose_unknown_messages then begin
212                      lprintf "Received unknown UDP packet"; lprint_newline ();                      lprintf "Received unknown UDP packet\n";
213                      dump pbuf;                      dump pbuf;
214                    end;                    end;
215                end else begin                end else begin
# Line 231  let udp_basic_handler f sock event = Line 217  let udp_basic_handler f sock event =
217                  f t p                  f t p
218                end                end
219            with e ->            with e ->
220                lprintf "Error %s in udp_basic_handler"                lprintf "Error %s in udp_basic_handler\n"
221                  (Printexc2.to_string e); lprint_newline ()                  (Printexc2.to_string e)
222        ) ;        ) ;
223    | _ -> ()    | _ -> ()
224    
# Line 250  let tag_file file = Line 236  let tag_file file =
236        let name = if String2.starts_with name "hidden." then        let name = if String2.starts_with name "hidden." then
237            String.sub name 7 (String.length name - 7)            String.sub name 7 (String.length name - 7)
238          else name in          else name in
239        if !verbose then begin        if !verbose then lprintf "SHARING %s\n" name;
           lprintf "SHARING %s" name; lprint_newline ();  
         end;  
240        name        name
241      ))::      ))::
242    (int64_tag Field_Size file.file_file.impl_file_size) ::    (int64_tag Field_Size file.file_file.impl_file_size) ::
# Line 261  let tag_file file = Line 245  let tag_file file =
245          FormatNotComputed next_time when          FormatNotComputed next_time when
246          next_time < last_time () ->          next_time < last_time () ->
247            (try            (try
248                if !verbose then begin                if !verbose then lprintf "%s: FIND FORMAT %s\n"
                   lprintf "%s: FIND FORMAT %s"  
249                      (string_of_date (last_time ()))                      (string_of_date (last_time ()))
250                    (file_disk_name file);                    (file_disk_name file);
                   lprint_newline ();  
                 end;  
251                file.file_format <- (                file.file_format <- (
252                  match                  match
253                  CommonMultimedia.get_info                  CommonMultimedia.get_info

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

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