fix deadlock
This commit is contained in:
parent
849928887e
commit
c78132417f
|
@ -159,7 +159,6 @@ pub struct Crdt {
|
||||||
pub remote: HashMap<PublicKey, u64>,
|
pub remote: HashMap<PublicKey, u64>,
|
||||||
pub update_index: u64,
|
pub update_index: u64,
|
||||||
pub me: PublicKey,
|
pub me: PublicKey,
|
||||||
timeout: Duration,
|
|
||||||
}
|
}
|
||||||
// TODO These messages should be signed, and go through the gpu pipeline for spam filtering
|
// TODO These messages should be signed, and go through the gpu pipeline for spam filtering
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
@ -184,7 +183,6 @@ impl Crdt {
|
||||||
remote: HashMap::new(),
|
remote: HashMap::new(),
|
||||||
me: me.id,
|
me: me.id,
|
||||||
update_index: 1,
|
update_index: 1,
|
||||||
timeout: Duration::from_millis(100),
|
|
||||||
};
|
};
|
||||||
g.local.insert(me.id, g.update_index);
|
g.local.insert(me.id, g.update_index);
|
||||||
g.table.insert(me.id, me);
|
g.table.insert(me.id, me);
|
||||||
|
@ -510,7 +508,6 @@ impl Crdt {
|
||||||
blob_sender: BlobSender,
|
blob_sender: BlobSender,
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
) -> JoinHandle<()> {
|
) -> JoinHandle<()> {
|
||||||
let timeout = obj.read().unwrap().timeout.clone();
|
|
||||||
Builder::new()
|
Builder::new()
|
||||||
.name("solana-gossip".to_string())
|
.name("solana-gossip".to_string())
|
||||||
.spawn(move || loop {
|
.spawn(move || loop {
|
||||||
|
@ -518,8 +515,9 @@ impl Crdt {
|
||||||
if exit.load(Ordering::Relaxed) {
|
if exit.load(Ordering::Relaxed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO this should be a tuned parameter
|
//TODO: possibly tune this parameter
|
||||||
sleep(timeout);
|
//we saw a deadlock passing an obj.read().unwrap().timeout into sleep
|
||||||
|
sleep(Duration::from_millis(100));
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue