Now actually downloads 2 files at a time

This commit is contained in:
Igor Katson 2021-10-10 10:46:09 +01:00
parent ba87529419
commit 2ac76683e6
2 changed files with 12 additions and 11 deletions

View file

@ -287,7 +287,7 @@ impl HttpApi {
Ok(idx) => {
return Ok(make_response(200, format!("{}", idx)));
}
Err(e) => return Ok(make_response(400, format!("{}", e))),
Err(e) => return Ok(make_response(400, format!("{:#}", e))),
}
}
}
@ -312,13 +312,13 @@ impl HttpApi {
});
let router = api_list
.or(torrent_list)
.or(dht_stats)
.or(dht_routing_table)
.or(torrent_details)
.or(torrent_dump_haves)
.or(torrent_dump_stats)
.or(torrent_add);
.or(torrent_add)
.or(torrent_list);
warp::serve(router).run(addr).await;
Ok(())

View file

@ -155,14 +155,6 @@ async fn async_main(opts: Opts, spawner: BlockingSpawner) -> anyhow::Result<()>
.context("error initializing rqbit session")?,
);
{
let http_api = HttpApi::new(session.clone());
spawn("HTTP API", {
let http_api_listen_addr = opts.http_api_listen_addr;
async move { http_api.make_http_api_and_run(http_api_listen_addr).await }
});
};
let torrent_opts = AddTorrentOptions {
only_files_regex: opts.only_files_matching_regex,
overwrite: opts.overwrite,
@ -180,6 +172,15 @@ async fn async_main(opts: Opts, spawner: BlockingSpawner) -> anyhow::Result<()>
None => return Ok(()),
};
{
let http_api = HttpApi::new(session.clone());
http_api.add_mgr(handle.clone());
spawn("HTTP API", {
let http_api_listen_addr = opts.http_api_listen_addr;
async move { http_api.make_http_api_and_run(http_api_listen_addr).await }
});
};
spawn("Stats printer", {
let handle = handle.clone();
async move {