Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
nojb committed Apr 19, 2014
1 parent 189403d commit 1a682c1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 49 deletions.
9 changes: 0 additions & 9 deletions _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ Library bt
Client, Rate, Addr, Tcp, Log, Udp, Wire
BuildDepends: lwt, uri, cohttp, cohttp.lwt, lwt.unix,
cryptokit, zarith, qcheck, bitstring, bitstring.syntax

Executable find_ih
Path: examples
MainIs: find_ih.ml
Build$: false
Custom: true
CompiledObject: best
Install: false
BuildDepends: bt.dht

Executable otorrent
Path: otorrent
Expand Down
6 changes: 1 addition & 5 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: d5079b5b311f66616c0a23f593b277e2)
# DO NOT EDIT (digest: f179b6d24145f7173ee7f547efe74cf8)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
Expand Down Expand Up @@ -43,10 +43,6 @@
<bt/*.ml{,i}>: pkg_qcheck
<bt/*.ml{,i}>: pkg_uri
<bt/*.ml{,i}>: pkg_zarith
# Executable find_ih
<examples/find_ih.{native,byte}>: pkg_bt.dht
<examples/*.ml{,i}>: pkg_bt.dht
<examples/find_ih.{native,byte}>: custom
# Executable otorrent
<otorrent/otorrent.{native,byte}>: pkg_bitstring
<otorrent/otorrent.{native,byte}>: pkg_bitstring.syntax
Expand Down
2 changes: 1 addition & 1 deletion bt/addr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let port (_, p) = p

let ip (ip, _) = ip

let to_string (ip, p) = Printf.sprintf "%s:%d" (Unix.string_of_inet_addr ip) p
let to_string (ip, p) = Printf.sprintf "[%s]:%d" (Unix.string_of_inet_addr ip) p

let to_string_compact (ip, p) =
let (a, b, c, d) = Ip.to_ints ip in
Expand Down
6 changes: 4 additions & 2 deletions bt/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ let handle_peer_event bt p = function
| Peer.BlockReceived (idx, off, s) ->
begin match bt.stage with
| Leeching (meta, t) ->
Log.success "received block (idx=%d,off=%d,len=%d)" idx off (String.length s);
Log.success "received block (idx=%d,off=%d,len=%d) from %s (%s/s)"
idx off (String.length s) (Addr.to_string (Peer.addr p))
(Util.string_of_file_size (Int64.of_float (Peer.download_rate p)));
let aux () =
Torrent.got_block t idx off s >|= function
| `Verified ->
Expand Down Expand Up @@ -494,7 +496,7 @@ let handle_event bt = function
let wakeup_peer _ p =
Peer.send_have_bitfield p bits;
if Torrent.got_bitfield t (Peer.have p) then begin
Log.success "we should be interested in %s" (Addr.to_string (Peer.addr p));
(* Log.success "we should be interested in %s" (Addr.to_string (Peer.addr p)); *)
Peer.send_interested p;
if not (Peer.peer_choking p) then
for i = 1 to max_requests do request_block bt p done
Expand Down
2 changes: 1 addition & 1 deletion bt/log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type level =
| ERROR
| FATAL

let current_level = ref INFO
let current_level = ref FATAL

type color =
| NONE
Expand Down
10 changes: 9 additions & 1 deletion otorrent/otorrent.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
open Cmdliner

let debug =
let doc = "Enable debug output (note: this generates a LOT of output)" in
Arg.(value & flag & info ["d"; "debug"] ~doc)

let magnets =
let doc = "Magnet link of the torrent(s) to download" in
Arg.(value & pos_all string [] & info [] ~docv:"MAGNET" ~doc)
Expand All @@ -10,8 +14,12 @@ let download magnet =
(fun () -> Bt.Client.start bt)
(fun e -> Bt.Log.error ~exn:e "fatal error during download"; Lwt.return ())

let download_all debug magnets =
if debug then Bt.Log.current_level := Bt.Log.INFO;
Lwt_main.run (Lwt_list.iter_p download magnets)

let download_t =
Term.(pure (fun xs -> Lwt_main.run (Lwt_list.iter_p download xs)) $ magnets)
Term.(pure download_all $ debug $ magnets)

let info =
let doc = "download torrent(s)" in
Expand Down
33 changes: 3 additions & 30 deletions setup.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.4.2 *)

(* OASIS_START *)
(* DO NOT EDIT (digest: f1c2e98c760f780566416986e823c6d7) *)
(* DO NOT EDIT (digest: ce15de05ca1ee09a58b46b5aa509c4f2) *)
(*
Regenerated by OASIS v0.4.4
Visit http://oasis.forge.ocamlcore.org for more information and
Expand Down Expand Up @@ -6753,33 +6753,6 @@ let setup_t =
lib_findlib_name = Some "bt";
lib_findlib_containers = []
});
Executable
({
cs_name = "find_ih";
cs_data = PropList.Data.create ();
cs_plugin_data = []
},
{
bs_build =
[
(OASISExpr.EBool true, false);
(OASISExpr.EBool false, true)
];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "examples";
bs_compiled_object = Best;
bs_build_depends = [FindlibPackage ("bt.dht", None)];
bs_build_tools = [ExternalTool "ocamlbuild"];
bs_c_sources = [];
bs_data_files = [];
bs_ccopt = [(OASISExpr.EBool true, [])];
bs_cclib = [(OASISExpr.EBool true, [])];
bs_dlllib = [(OASISExpr.EBool true, [])];
bs_dllpath = [(OASISExpr.EBool true, [])];
bs_byteopt = [(OASISExpr.EBool true, [])];
bs_nativeopt = [(OASISExpr.EBool true, [])]
},
{exec_custom = true; exec_main_is = "find_ih.ml"});
Executable
({
cs_name = "otorrent";
Expand Down Expand Up @@ -6816,14 +6789,14 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.4.4";
oasis_digest = Some "\133aÝøkï(z/\138\130ÍDy";
oasis_digest = Some "-´¤÷##\130@®ÂÚp&Uèz";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
};;

let setup () = BaseSetup.setup setup_t;;

# 6828 "setup.ml"
# 6801 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;

0 comments on commit 1a682c1

Please sign in to comment.