fix deadlock
This commit is contained in:
parent
246b8b1242
commit
6f9c89af39
|
@ -510,6 +510,7 @@ 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,11 +519,7 @@ impl Crdt {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO this should be a tuned parameter
|
//TODO this should be a tuned parameter
|
||||||
sleep(
|
sleep(timeout);
|
||||||
obj.read()
|
|
||||||
.expect("'obj' read lock in pub fn gossip")
|
|
||||||
.timeout,
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -568,7 +565,7 @@ impl Crdt {
|
||||||
match deserialize(&blob.data[..blob.meta.size]) {
|
match deserialize(&blob.data[..blob.meta.size]) {
|
||||||
// TODO sigverify these
|
// TODO sigverify these
|
||||||
Ok(Protocol::RequestUpdates(v, reqdata)) => {
|
Ok(Protocol::RequestUpdates(v, reqdata)) => {
|
||||||
trace!("RequestUpdates {}", v);
|
info!("RequestUpdates {}", v);
|
||||||
let addr = reqdata.gossip_addr;
|
let addr = reqdata.gossip_addr;
|
||||||
// only lock for this call, dont lock during IO `sock.send_to` or `sock.recv_from`
|
// only lock for this call, dont lock during IO `sock.send_to` or `sock.recv_from`
|
||||||
let (from, ups, data) = obj.read()
|
let (from, ups, data) = obj.read()
|
||||||
|
|
Loading…
Reference in New Issue