Refactor AccessList; update it periodically in aquatic_udp glommio

This commit is contained in:
Joakim Frostegård 2021-10-19 22:51:05 +02:00
parent cad3618fad
commit 38617c70f4
18 changed files with 141 additions and 77 deletions

View file

@ -1,9 +1,12 @@
use std::sync::{
atomic::{AtomicUsize, Ordering},
Arc,
};
use std::thread::Builder;
use std::time::Duration;
use std::{
ops::Deref,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
};
use anyhow::Context;
use crossbeam_channel::unbounded;
@ -56,7 +59,10 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
update_access_list(&config, &state.access_list);
state.torrents.lock().clean(&config, &state.access_list);
state
.torrents
.lock()
.clean(&config, state.access_list.load_full().deref());
}
}

View file

@ -7,6 +7,7 @@ use std::sync::{
use std::time::Duration;
use std::vec::Drain;
use aquatic_common::access_list::AccessListQuery;
use crossbeam_channel::{Receiver, Sender};
use mio::net::UdpSocket;
use mio::{Events, Interest, Poll, Token};
@ -15,6 +16,7 @@ use socket2::{Domain, Protocol, Socket, Type};
use aquatic_udp_protocol::{IpVersion, Request, Response};
use crate::common::network::ConnectionMap;
use crate::common::*;
use crate::config::Config;