mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Move fn update_access_list to aquatic_common
This commit is contained in:
parent
446fd0b1f4
commit
fa3b6bb259
5 changed files with 32 additions and 80 deletions
|
|
@ -107,6 +107,26 @@ pub fn create_access_list_cache(arc_swap: &Arc<AccessListArcSwap>) -> AccessList
|
|||
Cache::from(Arc::clone(arc_swap))
|
||||
}
|
||||
|
||||
pub fn update_access_list(
|
||||
config: &AccessListConfig,
|
||||
access_list: &Arc<AccessListArcSwap>,
|
||||
) -> anyhow::Result<()> {
|
||||
if config.mode.is_on() {
|
||||
match access_list.update(config) {
|
||||
Ok(()) => {
|
||||
::log::info!("Access list updated")
|
||||
}
|
||||
Err(err) => {
|
||||
::log::error!("Updating access list failed: {:#}", err);
|
||||
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
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