pub fn gossip(
        obj: Arc<RwLock<Self>>,
        blob_sender: BlobSender,
        exit: Arc<AtomicBool>,
    ) -> JoinHandle<()> {
        Builder::new()
            .name("solana-gossip".to_string())
            .spawn(move || loop {
                let start = timestamp();
                let _ = Self::run_gossip(&obj, &blob_sender);
                if exit.load(Ordering::Relaxed) {
                    return;
                }
                obj.write().unwrap().purge(timestamp());
                //TODO: possibly tune this parameter
                //we saw a deadlock passing an obj.read().unwrap().timeout into sleep
                let elapsed = timestamp() - start;
                if GOSSIP_SLEEP_MILLIS > elapsed {
                    let time_left = GOSSIP_SLEEP_MILLIS - elapsed;
                    sleep(Duration::from_millis(time_left));
                }
            }).unwrap()
    }
/// randomly pick a node and ask them for updates asynchronously
randomly pick a node and ask them for updates asynchronously
randomly pick a node and ask them for updates asynchronously
pub fn gossip(
        obj: Arc<RwLock<Self>>,
        blob_sender: BlobSender,
        exit: Arc<AtomicBool>,
    ) -> JoinHandle<()> {
        Builder::new()
            .name("solana-gossip".to_string())
            .spawn(move || loop {
                let start = timestamp();
                let _ = Self::run_gossip(&obj, &blob_sender);
                if exit.load(Ordering::Relaxed) {
                    return;
                }
                obj.write().unwrap().purge(timestamp());
                //TODO: possibly tune this parameter
                //we saw a deadlock passing an obj.read().unwrap().timeout into sleep
                let elapsed = timestamp() - start;
                if GOSSIP_SLEEP_MILLIS > elapsed {
                    let time_left = GOSSIP_SLEEP_MILLIS - elapsed;
                    sleep(Duration::from_millis(time_left));
                }
            }).unwrap()
    }
pub fn gossip ( obj : Arc < RwLock < Self > > , blob_sender : BlobSender , exit : Arc < AtomicBool > , ) -> JoinHandle < ( ) > { Builder :: new ( ) . name ( " " . to_string ( ) ) . spawn ( move | | loop { let start = timestamp ( ) ; let _ = Self :: run_gossip ( & obj , & blob_sender ) ; if exit . load ( Ordering :: Relaxed ) { return ; } obj . write ( ) . unwrap ( ) . purge ( timestamp ( ) ) ; //TODO: possibly tune this parameter //we saw a deadlock passing an obj.read().unwrap().timeout into sleep let elapsed = timestamp ( ) - start ; if GOSSIP_SLEEP_MILLIS > elapsed { let time_left = GOSSIP_SLEEP_MILLIS - elapsed ; sleep ( Duration :: from_millis ( time_left ) ) ; } } ) . unwrap ( ) }
randomly pick a node and ask them for updates asynchronously
randomly pick a node and ask them for updates asynchronously
obj
Arc<RwLock<Self>>
blob_sender
BlobSender
exit
Arc<AtomicBool>
obj
Arc<RwLock<Self>>
blob_sender
BlobSender
exit
Arc<AtomicBool>