mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_udp: glommio: use signals for access list update
This commit is contained in:
parent
a4d131359c
commit
fdaafae4b7
7 changed files with 97 additions and 105 deletions
|
|
@ -4,7 +4,7 @@ use std::path::PathBuf;
|
|||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Context;
|
||||
use arc_swap::ArcSwap;
|
||||
use arc_swap::{ArcSwap, Cache};
|
||||
use hashbrown::HashSet;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
@ -85,6 +85,7 @@ pub trait AccessListQuery {
|
|||
}
|
||||
|
||||
pub type AccessListArcSwap = ArcSwap<AccessList>;
|
||||
pub type AccessListCache = Cache<Arc<AccessListArcSwap>, Arc<AccessList>>;
|
||||
|
||||
impl AccessListQuery for AccessListArcSwap {
|
||||
fn update(&self, config: &AccessListConfig) -> anyhow::Result<()> {
|
||||
|
|
@ -102,6 +103,10 @@ impl AccessListQuery for AccessListArcSwap {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_access_list_cache(arc_swap: &Arc<AccessListArcSwap>) -> AccessListCache {
|
||||
Cache::from(Arc::clone(arc_swap))
|
||||
}
|
||||
|
||||
fn parse_info_hash(line: &str) -> anyhow::Result<[u8; 20]> {
|
||||
let mut bytes = [0u8; 20];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue