mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 02:05:30 +00:00
udp: PendingScrapeResponseSlab: use normal hashmap instead of amortized
This commit is contained in:
parent
256975a43c
commit
9479828b4a
3 changed files with 7 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -213,6 +213,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"crossbeam-channel",
|
||||
"getrandom",
|
||||
"hashbrown 0.12.0",
|
||||
"hex",
|
||||
"log",
|
||||
"mimalloc",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ blake3 = "1"
|
|||
cfg-if = "1"
|
||||
crossbeam-channel = "0.5"
|
||||
getrandom = "0.2"
|
||||
hashbrown = { version = "0.12", default-features = false }
|
||||
hex = "0.4"
|
||||
log = "0.4"
|
||||
mimalloc = { version = "0.1", default-features = false }
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ use std::vec::Drain;
|
|||
use anyhow::Context;
|
||||
use aquatic_common::privileges::PrivilegeDropper;
|
||||
use crossbeam_channel::Receiver;
|
||||
use hashbrown::HashMap;
|
||||
use mio::net::UdpSocket;
|
||||
use mio::{Events, Interest, Poll, Token};
|
||||
use slab::Slab;
|
||||
|
||||
use aquatic_common::access_list::create_access_list_cache;
|
||||
use aquatic_common::access_list::AccessListCache;
|
||||
use aquatic_common::{AmortizedIndexMap, CanonicalSocketAddr};
|
||||
use aquatic_common::CanonicalSocketAddr;
|
||||
use aquatic_common::{PanicSentinel, ValidUntil};
|
||||
use aquatic_udp_protocol::*;
|
||||
use socket2::{Domain, Protocol, Socket, Type};
|
||||
|
|
@ -39,8 +40,9 @@ impl PendingScrapeResponseSlab {
|
|||
request: ScrapeRequest,
|
||||
valid_until: ValidUntil,
|
||||
) -> impl IntoIterator<Item = (RequestWorkerIndex, PendingScrapeRequest)> {
|
||||
let mut split_requests: AmortizedIndexMap<RequestWorkerIndex, PendingScrapeRequest> =
|
||||
Default::default();
|
||||
let capacity = config.request_workers.min(request.info_hashes.len());
|
||||
let mut split_requests: HashMap<RequestWorkerIndex, PendingScrapeRequest> =
|
||||
HashMap::with_capacity(capacity);
|
||||
|
||||
if request.info_hashes.is_empty() {
|
||||
::log::warn!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue