Add http api for debugging
This commit is contained in:
parent
1cb7a7bbc6
commit
a3e84e4a99
6 changed files with 359 additions and 15 deletions
13
crates/librqbit/src/http_api.rs
Normal file
13
crates/librqbit/src/http_api.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use warp::Filter;
|
||||
|
||||
use crate::torrent_state::TorrentState;
|
||||
|
||||
// This is just a stub for debugging, nothing useful here.
|
||||
pub async fn make_and_run_http_api(state: Arc<TorrentState>) -> anyhow::Result<()> {
|
||||
let dump_haves = warp::path("haves")
|
||||
.map(move || format!("{:?}", state.locked.read().chunks.get_have_pieces()));
|
||||
warp::serve(dump_haves).run(([127, 0, 0, 1], 3030)).await;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue