mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Refactor AccessList; update it periodically in aquatic_udp glommio
This commit is contained in:
parent
cad3618fad
commit
38617c70f4
18 changed files with 141 additions and 77 deletions
|
|
@ -2,7 +2,7 @@ use std::net::{IpAddr, SocketAddr};
|
|||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
|
||||
use aquatic_common::access_list::AccessList;
|
||||
use aquatic_common::access_list::{AccessList, AccessListArcSwap};
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use hashbrown::HashMap;
|
||||
use indexmap::IndexMap;
|
||||
|
|
@ -136,7 +136,7 @@ impl TorrentMaps {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct State {
|
||||
pub access_list: Arc<AccessList>,
|
||||
pub access_list: Arc<AccessListArcSwap>,
|
||||
pub torrent_maps: Arc<Mutex<TorrentMaps>>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ pub fn run(config: Config) -> anyhow::Result<()> {
|
|||
|
||||
tasks::update_access_list(&config, &state);
|
||||
|
||||
state.torrent_maps.lock().clean(&config, &state.access_list);
|
||||
state
|
||||
.torrent_maps
|
||||
.lock()
|
||||
.clean(&config, &state.access_list.load_full());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use std::io::ErrorKind;
|
|||
use std::time::Duration;
|
||||
use std::vec::Drain;
|
||||
|
||||
use aquatic_common::access_list::AccessListQuery;
|
||||
use crossbeam_channel::Receiver;
|
||||
use hashbrown::HashMap;
|
||||
use log::{debug, error, info};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use aquatic_common::access_list::AccessListMode;
|
||||
use aquatic_common::access_list::{AccessListMode, AccessListQuery};
|
||||
use histogram::Histogram;
|
||||
|
||||
use crate::common::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue