mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_udp: glommio: improve access list error reporting
This commit is contained in:
parent
072f064138
commit
2732e520f7
1 changed files with 22 additions and 13 deletions
|
|
@ -10,23 +10,32 @@ use crate::config::Config;
|
|||
|
||||
pub async fn update_access_list(config: Config, access_list: Rc<RefCell<AccessList>>) {
|
||||
if config.access_list.mode.is_on() {
|
||||
let access_list_file = BufferedFile::open(config.access_list.path).await.unwrap();
|
||||
match BufferedFile::open(config.access_list.path).await {
|
||||
Ok(file) => {
|
||||
let mut reader = StreamReaderBuilder::new(file).build();
|
||||
|
||||
let mut reader = StreamReaderBuilder::new(access_list_file).build();
|
||||
loop {
|
||||
let mut buf = String::with_capacity(42);
|
||||
|
||||
loop {
|
||||
let mut buf = String::with_capacity(42);
|
||||
match reader.read_line(&mut buf).await {
|
||||
Ok(_) => {
|
||||
if let Err(err) = access_list.borrow_mut().insert_from_line(&buf) {
|
||||
::log::error!("Couln't parse access list line '{}': {:?}", buf, err);
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
::log::error!("Couln't read access list line {:?}", err);
|
||||
|
||||
match reader.read_line(&mut buf).await {
|
||||
Ok(_) => {
|
||||
access_list.borrow_mut().insert_from_line(&buf);
|
||||
}
|
||||
Err(err) => {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
yield_if_needed().await;
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
::log::error!("Couldn't open access list file: {:?}", err)
|
||||
}
|
||||
|
||||
yield_if_needed().await;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue