mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 02:35:31 +00:00
aquatic_udp: add privdrop failsafe timeout
This commit is contained in:
parent
3bb6c1994c
commit
cedf60155e
1 changed files with 8 additions and 0 deletions
|
|
@ -26,6 +26,8 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
||||||
let num_bound_sockets = start_workers(config.clone(), state.clone())?;
|
let num_bound_sockets = start_workers(config.clone(), state.clone())?;
|
||||||
|
|
||||||
if config.privileges.drop_privileges {
|
if config.privileges.drop_privileges {
|
||||||
|
let mut counter = 0usize;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let sockets = num_bound_sockets.load(Ordering::SeqCst);
|
let sockets = num_bound_sockets.load(Ordering::SeqCst);
|
||||||
|
|
||||||
|
|
@ -39,6 +41,12 @@ pub fn run(config: Config) -> ::anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
::std::thread::sleep(Duration::from_millis(10));
|
::std::thread::sleep(Duration::from_millis(10));
|
||||||
|
|
||||||
|
counter += 1;
|
||||||
|
|
||||||
|
if counter == 500 {
|
||||||
|
panic!("Sockets didn't bind in time for privilege drop.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue