Merge pull request #758 from jb-alvarado/master

prevent index out of bounds
This commit is contained in:
jb-alvarado 2024-09-23 08:24:00 +02:00 committed by GitHub
commit f0b0ec7d96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 7 deletions

4
Cargo.lock generated
View File

@ -1215,7 +1215,7 @@ checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
[[package]]
name = "ffplayout"
version = "0.24.0-beta4"
version = "0.24.0-rc1"
dependencies = [
"actix-files",
"actix-multipart",
@ -3681,7 +3681,7 @@ dependencies = [
[[package]]
name = "tests"
version = "0.24.0-beta4"
version = "0.24.0-rc1"
dependencies = [
"actix-rt",
"actix-test",

View File

@ -4,7 +4,7 @@ default-members = ["ffplayout", "tests"]
resolver = "2"
[workspace.package]
version = "0.24.0-beta4"
version = "0.24.0-rc1"
license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -94,7 +94,12 @@ async fn main() -> std::io::Result<()> {
let ip_port = conn.split(':').collect::<Vec<&str>>();
let addr = ip_port[0];
let port = ip_port[1].parse::<u16>().unwrap();
let port = ip_port
.get(1)
.ok_or("<ADRESSE>:<PORT> needed!")
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?
.parse::<u16>()
.unwrap();
let controllers = web::Data::from(channel_controllers.clone());
let auth_state = web::Data::new(SseAuthState {
uuids: tokio::sync::Mutex::new(HashSet::new()),

View File

@ -136,7 +136,6 @@ impl Iterator for FolderSource {
self.current_node
.add_filter(&config, &self.manager.filter_chain);
self.current_node.begin = Some(time_in_seconds());
self.manager.current_index.fetch_add(1, Ordering::SeqCst);
Some(self.current_node.clone())
@ -155,12 +154,14 @@ impl Iterator for FolderSource {
self.sort();
}
self.current_node = self.manager.current_list.lock().unwrap()[0].clone();
self.current_node = match self.manager.current_list.lock().unwrap().first() {
Some(m) => m.clone(),
None => return None,
};
let _ = self.current_node.add_probe(false).ok();
self.current_node
.add_filter(&config, &self.manager.filter_chain);
self.current_node.begin = Some(time_in_seconds());
self.manager.current_index.store(1, Ordering::SeqCst);
Some(self.current_node.clone())