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 |
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); |
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 |
| _ -> |
| _ -> |
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 |