mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
fix deadlock on sso network leave
This commit is contained in:
parent
f3b56d3d94
commit
dac32f863e
2 changed files with 13 additions and 10 deletions
|
@ -80,6 +80,12 @@ pub extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let idc = unsafe {
|
||||||
|
assert!(!ptr.is_null());
|
||||||
|
&mut *ptr
|
||||||
|
};
|
||||||
|
idc.stop();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Box::from_raw(ptr);
|
Box::from_raw(ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,8 +311,10 @@ impl ZeroIDC {
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(Duration::from_secs(1));
|
sleep(Duration::from_secs(1));
|
||||||
|
{
|
||||||
running = (*inner_local.lock().unwrap()).running;
|
running = (*inner_local.lock().unwrap()).running;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
println!("thread done!")
|
println!("thread done!")
|
||||||
}));
|
}));
|
||||||
|
@ -321,21 +323,16 @@ impl ZeroIDC {
|
||||||
|
|
||||||
pub fn stop(&mut self) {
|
pub fn stop(&mut self) {
|
||||||
let local = self.inner.clone();
|
let local = self.inner.clone();
|
||||||
if (*local.lock().unwrap()).running {
|
if self.is_running(){
|
||||||
if let Some(u) = (*local.lock().unwrap()).oidc_thread.take() {
|
(*local.lock().unwrap()).running = false;
|
||||||
u.join().expect("join failed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_running(&mut self) -> bool {
|
pub fn is_running(&mut self) -> bool {
|
||||||
let local = Arc::clone(&self.inner);
|
let local = Arc::clone(&self.inner);
|
||||||
|
let running = (*local.lock().unwrap()).running;
|
||||||
|
|
||||||
if (*local.lock().unwrap()).running {
|
running
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_exp_time(&mut self) -> u64 {
|
pub fn get_exp_time(&mut self) -> u64 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue