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

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

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

revision 1.17 by spiralvoice, Sun Jul 10 23:19:16 2005 UTC revision 1.18 by spiralvoice, Thu Aug 4 22:00:23 2005 UTC
# Line 29  let client_port = define_option bittorre Line 29  let client_port = define_option bittorre
29      "The port to bind the client to"      "The port to bind the client to"
30      int_option 6882      int_option 6882
31    
32    (* Generate client_uid *)
33    let generate_client_uid =
34      let client_uid_from_version = "-ML" ^ Autoconf.current_version ^ "-" in
35      let client_uid_random_tail = String.create (20 - (String.length client_uid_from_version)) in
36      let sl_client_uid_random_tail = String.length client_uid_random_tail in
37      if sl_client_uid_random_tail > 0  then
38        for i = 0 to sl_client_uid_random_tail - 1 do
39          client_uid_random_tail.[i] <- char_of_int (Random.int 256)
40        done;
41      client_uid_from_version ^ client_uid_random_tail
42    
43  let client_uid = define_option bittorrent_section ["client_uid"]  let client_uid = define_option bittorrent_section ["client_uid"]
44      "The UID of this client" Sha1.option (Sha1.random ())      "The UID of this client" Sha1.option (Sha1.direct_of_string generate_client_uid)
45    
46    (* Check if the uid is in sync with Autoconf.current_version *)
47    let check_client_uid () =
48      let s = Sha1.direct_to_string !!client_uid in
49      if Autoconf.current_version != String.sub s 3 ((
50        try
51          String.index_from s 1 s.[0]
52        with
53          Not_found -> 3
54        ) - 3) then
55        client_uid =:= Sha1.direct_of_string generate_client_uid
56    
57  let shortname o =  let shortname o =
58    Printf.sprintf "BT-%s" (shortname o)    Printf.sprintf "BT-%s" (shortname o)
# Line 44  let ask_tracker_threshold = define_optio Line 66  let ask_tracker_threshold = define_optio
66      "Ask the tracker for new sources only if you have fewer than that number of sources"      "Ask the tracker for new sources only if you have fewer than that number of sources"
67      int_option 20      int_option 20
68    
69    let send_key = define_option bittorrent_section ["send_key"]
70        "Send client key to trackers"
71        bool_option true
72    
73  let max_uploaders_per_torrent = define_option bittorrent_section ["max_uploaders_per_torrent"]  let max_uploaders_per_torrent = define_option bittorrent_section ["max_uploaders_per_torrent"]
74      "Maximum number of uploaders for one torrent"      "Maximum number of uploaders for one torrent"
75      int_option 5      int_option 5

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

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