Skip to content

Commit 54bf01a

Browse files
committed
refactor: renamed webserver to http_api_server
1 parent 2ff93d8 commit 54bf01a

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/webserver.rs src/http_api_server.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,13 @@ pub fn build_server(tracker: Arc<TorrentTracker>) -> Server<impl Filter<Extract
174174
(info_hash, tracker)
175175
})
176176
.and_then(|(info_hash, tracker): (InfoHash, Arc<TorrentTracker>)| {
177-
async move {
178-
match tracker.add_torrent_to_whitelist(&info_hash).await {
179-
Ok(..) => Ok(warp::reply::json(&ActionStatus::Ok)),
180-
Err(..) => Err(warp::reject::custom(ActionStatus::Err { reason: "failed to whitelist torrent".into() }))
181-
}
177+
async move {
178+
match tracker.add_torrent_to_whitelist(&info_hash).await {
179+
Ok(..) => Ok(warp::reply::json(&ActionStatus::Ok)),
180+
Err(..) => Err(warp::reject::custom(ActionStatus::Err { reason: "failed to whitelist torrent".into() }))
182181
}
183-
},
184-
);
182+
}
183+
});
185184

186185
// POST /api/key/:seconds_valid
187186
// Generate new key

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod config;
22
pub mod udp_server;
33
pub mod http_server;
44
pub mod tracker;
5-
pub mod webserver;
5+
pub mod http_api_server;
66
pub mod common;
77
pub mod response;
88
pub mod utils;
@@ -14,6 +14,6 @@ pub use self::config::*;
1414
pub use self::udp_server::*;
1515
pub use self::http_server::*;
1616
pub use self::tracker::*;
17-
pub use self::webserver::*;
17+
pub use self::http_api_server::*;
1818
pub use self::common::*;
1919
pub use self::response::*;

src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use log::{info};
2-
use torrust_tracker::{webserver, Configuration, TorrentTracker, UdpServer, HttpTrackerConfig, UdpTrackerConfig, HttpApiConfig, logging};
2+
use torrust_tracker::{http_api_server, Configuration, TorrentTracker, UdpServer, HttpTrackerConfig, UdpTrackerConfig, HttpApiConfig, logging};
33
use std::sync::Arc;
44
use tokio::task::JoinHandle;
55
use torrust_tracker::http_server::HttpServer;
@@ -72,7 +72,7 @@ fn start_api_server(config: &HttpApiConfig, tracker: Arc<TorrentTracker>) -> Joi
7272
let bind_addr = config.bind_address.parse::<std::net::SocketAddr>().unwrap();
7373

7474
tokio::spawn(async move {
75-
let server = webserver::build_server(tracker);
75+
let server = http_api_server::build_server(tracker);
7676
server.bind(bind_addr).await;
7777
})
7878
}

0 commit comments

Comments
 (0)