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

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

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

revision 1.5 by spiralvoice, Sun Jul 10 23:19:16 2005 UTC revision 1.6 by spiralvoice, Wed Jul 27 20:06:16 2005 UTC
# Line 31  open BTOptions Line 31  open BTOptions
31  open BTTypes  open BTTypes
32  open Bencode  open Bencode
33    
   
34  open Gettext  open Gettext
35  let _s x = _s "BTTorrent" x  let _s x = _s "BTTorrent" x
36  let _b x = _b "BTTorrent" x  let _b x = _b "BTTorrent" x
# Line 92  let decode_torrent s = Line 91  let decode_torrent s =
91                            match v with                            match v with
92                              String s -> s                              String s -> s
93                            | _ -> assert false                            | _ -> assert false
94                        ) path)                        ) path);
95                        if !verbose_msg_servers then
96                          lprintf_nl "[BT]: New file received :%s" !current_file
97                    | String "path.utf-8", String path_utf8 -> ()
98                  | String "length", Int n ->                  | String "length", Int n ->
99                      length := !length ++ n;                      length := !length ++ n;
100                      current_length := n;                      current_length := n;
101                      length_set := true                      length_set := true
102    
103                  | String key, _ ->                  | String key, _ ->
104                      if !verbose_msg_servers then lprintf "other field [%s] in files\n" key                      if !verbose_msg_servers then lprintf_nl "[BT]: other field [%s] with value [%s] in files" key (Bencode.print value)
105                  | _ ->                  | _ ->
106                      lprintf_nl "[BT]: other field in files\n"                      lprintf_nl "[BT]: other field in files"
107              ) list;              ) list;
108    
109              assert (!length_set);              assert (!length_set);
# Line 198  let encode_torrent torrent = Line 199  let encode_torrent torrent =
199    in    in
200    
201    let files =    let files =
202      match torrent.torrent_files with      match torrent.torrent_files with
203        [] ->        [] ->
204          String "length", Int torrent.torrent_length          String "length", Int torrent.torrent_length
205      | _ ->      | _ ->
# Line 260  let make_torrent announce filename = Line 261  let make_torrent announce filename =
261      let begin_pos = chunk_size *.. i in      let begin_pos = chunk_size *.. i in
262    
263      let end_pos = begin_pos ++ chunk_size in      let end_pos = begin_pos ++ chunk_size in
264      let end_pos =      let end_pos =
265        if end_pos > length then length else end_pos in        if end_pos > length then length else end_pos in
266    
267      let sha1 = Sha1.digest_subfile t      let sha1 = Sha1.digest_subfile t

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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