fix weird end-of-file bug by having downloaders use inotify to directly track changes
This commit is contained in:
parent
ba4c7bfcbe
commit
cc0aaaab94
8 changed files with 246 additions and 283 deletions
10
src/state.rs
10
src/state.rs
|
@ -1,6 +1,6 @@
|
|||
use std::{collections::HashMap, io::ErrorKind};
|
||||
|
||||
use log::{error, info, warn, debug};
|
||||
use log::{debug, error, info, warn};
|
||||
use tokio::{
|
||||
fs::File,
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
|
@ -52,7 +52,7 @@ pub(crate) mod timestamp {
|
|||
}
|
||||
|
||||
async fn is_valid_entry(key: &str, info: &DownloadableFile) -> bool {
|
||||
if !crate::util::is_ascii_alphanumeric(&key) {
|
||||
if !crate::util::is_ascii_alphanumeric(key) {
|
||||
error!("Invalid key in persistent storage: {}", key);
|
||||
return false;
|
||||
}
|
||||
|
@ -142,10 +142,4 @@ impl PersistentState {
|
|||
self.0.remove(key);
|
||||
self.save().await
|
||||
}
|
||||
|
||||
pub(crate) fn remove_uploader(&mut self, key: &str) {
|
||||
if let Some(f) = self.0.get_mut(key) {
|
||||
f.uploader.take();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue