From 6f9c89af39e2bf1a944517fbde9b0c6015f0c505 Mon Sep 17 00:00:00 2001 From: Anatoly Yakovenko Date: Thu, 7 Jun 2018 15:42:12 +0000 Subject: [PATCH] fix deadlock --- src/crdt.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/crdt.rs b/src/crdt.rs index 2cbb02a30e..87a4417197 100644 --- a/src/crdt.rs +++ b/src/crdt.rs @@ -510,6 +510,7 @@ impl Crdt { blob_sender: BlobSender, exit: Arc, ) -> JoinHandle<()> { + let timeout = obj.read().unwrap().timeout.clone(); Builder::new() .name("solana-gossip".to_string()) .spawn(move || loop { @@ -518,11 +519,7 @@ impl Crdt { return; } //TODO this should be a tuned parameter - sleep( - obj.read() - .expect("'obj' read lock in pub fn gossip") - .timeout, - ); + sleep(timeout); }) .unwrap() } @@ -568,7 +565,7 @@ impl Crdt { match deserialize(&blob.data[..blob.meta.size]) { // TODO sigverify these Ok(Protocol::RequestUpdates(v, reqdata)) => { - trace!("RequestUpdates {}", v); + info!("RequestUpdates {}", v); let addr = reqdata.gossip_addr; // only lock for this call, dont lock during IO `sock.send_to` or `sock.recv_from` let (from, ups, data) = obj.read()