mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
http, http_private: rename request workers to swarm workers
This commit is contained in:
parent
fb2794643d
commit
c89406179b
12 changed files with 31 additions and 33 deletions
|
|
@ -1,2 +1,2 @@
|
|||
pub mod request;
|
||||
pub mod socket;
|
||||
pub mod swarm;
|
||||
|
|
|
|||
|
|
@ -264,10 +264,10 @@ impl Connection {
|
|||
/// Take a request and:
|
||||
/// - Update connection ValidUntil
|
||||
/// - Return error response if request is not allowed
|
||||
/// - If it is an announce request, send it to request workers an await a
|
||||
/// - If it is an announce request, send it to swarm workers an await a
|
||||
/// response
|
||||
/// - If it is a scrape requests, split it up, pass on the parts to
|
||||
/// relevant request workers and await a response
|
||||
/// relevant swarm workers and await a response
|
||||
async fn handle_request(&mut self, request: Request) -> anyhow::Result<Response> {
|
||||
if let Ok(mut slab) = self.connection_slab.try_borrow_mut() {
|
||||
if let Some(reference) = slab.get_mut(self.connection_id.0) {
|
||||
|
|
@ -448,7 +448,7 @@ impl Connection {
|
|||
}
|
||||
|
||||
fn calculate_request_consumer_index(config: &Config, info_hash: InfoHash) -> usize {
|
||||
(info_hash.0[0] as usize) % config.request_workers
|
||||
(info_hash.0[0] as usize) % config.swarm_workers
|
||||
}
|
||||
|
||||
fn create_tcp_listener(
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ impl TorrentMaps {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn run_request_worker(
|
||||
pub async fn run_swarm_worker(
|
||||
_sentinel: PanicSentinel,
|
||||
config: Config,
|
||||
state: State,
|
||||
|
|
@ -235,7 +235,7 @@ async fn handle_request_stream<S>(
|
|||
);
|
||||
|
||||
if let Err(err) = response_sender.connect().await.send(response).await {
|
||||
::log::error!("request worker could not send announce response: {:#}", err);
|
||||
::log::error!("swarm worker could not send announce response: {:#}", err);
|
||||
}
|
||||
}
|
||||
ChannelRequest::Scrape {
|
||||
|
|
@ -247,7 +247,7 @@ async fn handle_request_stream<S>(
|
|||
handle_scrape_request(&config, &mut torrents.borrow_mut(), peer_addr, request);
|
||||
|
||||
if let Err(err) = response_sender.connect().await.send(response).await {
|
||||
::log::error!("request worker could not send scrape response: {:#}", err);
|
||||
::log::error!("swarm worker could not send scrape response: {:#}", err);
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue