pub fn process_push_message(
        &mut self,
        crds: &mut Crds,
        from: &Pubkey,
        value: CrdsValue,
        now: u64,
    ) -> Result<Option<VersionedCrdsValue>, CrdsGossipError> {
        if now > value.wallclock() + self.msg_timeout {
            return Err(CrdsGossipError::PushMessageTimeout);
        }
        if now + self.msg_timeout < value.wallclock() {
            return Err(CrdsGossipError::PushMessageTimeout);
        }
        let label = value.label();
        let new_value = crds.new_versioned(now, value);
        let value_hash = new_value.value_hash;
        if let Some((_, ref mut received_set)) = self.received_cache.get_mut(&value_hash) {
            received_set.insert(from.clone());
            return Err(CrdsGossipError::PushMessageAlreadyReceived);
        }
        let old = crds.insert_versioned(new_value);
        if old.is_err() {
            return Err(CrdsGossipError::PushMessageOldVersion);
        }
        let mut received_set = HashSet::new();
        received_set.insert(from.clone());
        self.push_messages.insert(label, value_hash);
        self.received_cache.insert(value_hash, (now, received_set));
        Ok(old.ok().and_then(|opt| opt))
    }
/// process a push message to the network
process a push message to the network
process a push message to the network
pub fn process_push_message(
        &mut self,
        crds: &mut Crds,
        from: &Pubkey,
        value: CrdsValue,
        now: u64,
    ) -> Result<Option<VersionedCrdsValue>, CrdsGossipError> {
        if now > value.wallclock() + self.msg_timeout {
            return Err(CrdsGossipError::PushMessageTimeout);
        }
        if now + self.msg_timeout < value.wallclock() {
            return Err(CrdsGossipError::PushMessageTimeout);
        }
        let label = value.label();
        let new_value = crds.new_versioned(now, value);
        let value_hash = new_value.value_hash;
        if let Some((_, ref mut received_set)) = self.received_cache.get_mut(&value_hash) {
            received_set.insert(from.clone());
            return Err(CrdsGossipError::PushMessageAlreadyReceived);
        }
        let old = crds.insert_versioned(new_value);
        if old.is_err() {
            return Err(CrdsGossipError::PushMessageOldVersion);
        }
        let mut received_set = HashSet::new();
        received_set.insert(from.clone());
        self.push_messages.insert(label, value_hash);
        self.received_cache.insert(value_hash, (now, received_set));
        Ok(old.ok().and_then(|opt| opt))
    }
pub fn process_push_message ( & mut self , crds : & mut Crds , from : & Pubkey , value : CrdsValue , now : u64 , ) -> Result < Option < VersionedCrdsValue > , CrdsGossipError > { if now > value . wallclock ( ) + self . msg_timeout { return Err ( CrdsGossipError :: PushMessageTimeout ) ; } if now + self . msg_timeout < value . wallclock ( ) { return Err ( CrdsGossipError :: PushMessageTimeout ) ; } let label = value . label ( ) ; let new_value = crds . new_versioned ( now , value ) ; let value_hash = new_value . value_hash ; if let Some ( ( _ , ref mut received_set ) ) = self . received_cache . get_mut ( & value_hash ) { received_set . insert ( from . clone ( ) ) ; return Err ( CrdsGossipError :: PushMessageAlreadyReceived ) ; } let old = crds . insert_versioned ( new_value ) ; if old . is_err ( ) { return Err ( CrdsGossipError :: PushMessageOldVersion ) ; } let mut received_set = HashSet :: new ( ) ; received_set . insert ( from . clone ( ) ) ; self . push_messages . insert ( label , value_hash ) ; self . received_cache . insert ( value_hash , ( now , received_set ) ) ; Ok ( old . ok ( ) . and_then ( | opt | opt ) ) }
process a push message to the network
process a push message to the network
&mut self
crds
&mut Crds
from
&Pubkey
value
CrdsValue
now
u64
&mut self
crds
&mut Crds
from
&Pubkey
value
CrdsValue
now
u64