pub fn handle_ack_nack(&mut self, reader_guid_prefix: GuidPrefix, an: AckNack) {
    // sanity check
    if !self.is_reliable() {
      warn!("Writer {:x?} is best effort! It should not handle acknack messages!", 
              self.get_entity_id());
      return
    }
    // Update the ReaderProxy
    let last_seq = self.last_change_sequence_number; // to avoid borrow problems
    if let Some(reader_proxy) = self.lookup_readerproxy_mut(reader_guid_prefix, an.reader_id) {

        reader_proxy.handle_ack_nack(&an, last_seq);

        let reader_guid = reader_proxy.remote_reader_guid; // copy to avoid double mut borrow 
        // Sanity Check: if the reader asked for something we did not even advertise yet.
        // TODO: This checks the stored unset_changes, not presentely received ACKNACK.
        if let Some(&high) = reader_proxy.unsent_changes.iter().next_back()  {
          if high > last_seq { 
            warn!("ReaderProxy {:?} thinks we need to send {:?} but I have only up to {:?}", 
              reader_proxy.remote_reader_guid, reader_proxy.unsent_changes, last_seq);
          }
        }
        // Sanity Check
        if an.reader_sn_state.base() > last_seq + SequenceNumber::from(1) { // more sanity
          warn!("ACKNACK from {:?} acks up to before {:?} but I have only up to {:?}",
            reader_proxy.remote_reader_guid, reader_proxy.unsent_changes, last_seq);
        }
        // TODO: The following check is rather expensive. Maybe should turn it off
        // in release build?
        if let Some( max_req_sn ) = an.reader_sn_state.iter().max() { // sanity check
          if max_req_sn > last_seq {
            warn!("ACKNACK from {:?} requests {:?} but I have only up to {:?}",
              reader_proxy.remote_reader_guid, 
              an.reader_sn_state.iter().collect::<Vec<SequenceNumber>>(), last_seq);
          }
        }

        // if we cannot send more data, we are done.
        // This is to prevent empty "repair data" messages from being sent.
        if reader_proxy.all_acked_before > last_seq {
          return 
        } else {
          // prime timer to send repair data
          reader_proxy.repair_mode = true; // hold sending normal DATA
          self.timed_event_handler.as_mut().unwrap().set_timeout(
            &chronoDuration::from_std(NACK_RESPONSE_DELAY).unwrap(),
            TimerMessageType::WriterSendRepairData{ to_reader: reader_guid },
          );
        }
    }
  }
/// When receiving an ACKNACK Message indicating a Reader is missing some data samples, the Writer must
/// respond by either sending the missing data samples, sending a GAP message when the sample is not relevant, or
/// sending a HEARTBEAT message when the sample is no longer available
When receiving an ACKNACK Message indicating a Reader is missing some data samples, the Writer must
respond by either sending the missing data samples, sending a GAP message when the sample is not relevant, or
sending a HEARTBEAT message when the sample is no longer available
When receiving an ACKNACK Message indicating a Reader is missing some data samples the Writer must respond by either sending the missing data samples sending a GAP message when the sample is not relevant or sending a HEARTBEAT message when the sample is no longer available
pub fn handle_ack_nack(&mut self, reader_guid_prefix: GuidPrefix, an: AckNack) {
    // sanity check
    if !self.is_reliable() {
      warn!("Writer {:x?} is best effort! It should not handle acknack messages!", 
              self.get_entity_id());
      return
    }
    // Update the ReaderProxy
    let last_seq = self.last_change_sequence_number; // to avoid borrow problems
    if let Some(reader_proxy) = self.lookup_readerproxy_mut(reader_guid_prefix, an.reader_id) {
        reader_proxy.handle_ack_nack(&an, last_seq);
        let reader_guid = reader_proxy.remote_reader_guid; // copy to avoid double mut borrow 
        // Sanity Check: if the reader asked for something we did not even advertise yet.
        // TODO: This checks the stored unset_changes, not presentely received ACKNACK.
        if let Some(&high) = reader_proxy.unsent_changes.iter().next_back()  {
          if high > last_seq { 
            warn!("ReaderProxy {:?} thinks we need to send {:?} but I have only up to {:?}", 
              reader_proxy.remote_reader_guid, reader_proxy.unsent_changes, last_seq);
          }
        }
        // Sanity Check
        if an.reader_sn_state.base() > last_seq + SequenceNumber::from(1) { // more sanity
          warn!("ACKNACK from {:?} acks up to before {:?} but I have only up to {:?}",
            reader_proxy.remote_reader_guid, reader_proxy.unsent_changes, last_seq);
        }
        // TODO: The following check is rather expensive. Maybe should turn it off
        // in release build?
        if let Some( max_req_sn ) = an.reader_sn_state.iter().max() { // sanity check
          if max_req_sn > last_seq {
            warn!("ACKNACK from {:?} requests {:?} but I have only up to {:?}",
              reader_proxy.remote_reader_guid, 
              an.reader_sn_state.iter().collect::<Vec<SequenceNumber>>(), last_seq);
          }
        }
        // if we cannot send more data, we are done.
        // This is to prevent empty "repair data" messages from being sent.
        if reader_proxy.all_acked_before > last_seq {
          return 
        } else {
          // prime timer to send repair data
          reader_proxy.repair_mode = true; // hold sending normal DATA
          self.timed_event_handler.as_mut().unwrap().set_timeout(
            &chronoDuration::from_std(NACK_RESPONSE_DELAY).unwrap(),
            TimerMessageType::WriterSendRepairData{ to_reader: reader_guid },
          );
        }
    }
  }
pub fn handle_ack_nack ( & mut self , reader_guid_prefix : GuidPrefix , an : AckNack ) { // sanity check if ! self . is_reliable ( ) { warn ! ( " " self get_entity_id ( ) ) ; return } // Update the ReaderProxy let last_seq = self . last_change_sequence_number ; // to avoid borrow problems if let Some ( reader_proxy ) = self . lookup_readerproxy_mut ( reader_guid_prefix , an . reader_id ) { reader_proxy . handle_ack_nack ( & an , last_seq ) ; let reader_guid = reader_proxy . remote_reader_guid ; // copy to avoid double mut borrow  // Sanity Check: if the reader asked for something we did not even advertise yet. // TODO: This checks the stored unset_changes, not presentely received ACKNACK. if let Some ( & high ) = reader_proxy . unsent_changes . iter ( ) . next_back ( ) { if high > last_seq { warn ! ( " " reader_proxy remote_reader_guid reader_proxy unsent_changes last_seq ) ; } } // Sanity Check if an . reader_sn_state . base ( ) > last_seq + SequenceNumber :: from ( 1 ) { // more sanity warn ! ( " , reader_proxy remote_reader_guid reader_proxy unsent_changes last_seq ) ; } // TODO: The following check is rather expensive. Maybe should turn it off // in release build? if let Some ( max_req_sn ) = an . reader_sn_state . iter ( ) . max ( ) { // sanity check if max_req_sn > last_seq { warn ! ( " , reader_proxy remote_reader_guid an reader_sn_state iter ( ) collect Vec SequenceNumber ( ) last_seq ) ; } } // if we cannot send more data, we are done. // This is to prevent empty "repair data" messages from being sent. if reader_proxy . all_acked_before > last_seq { return } else { // prime timer to send repair data reader_proxy . repair_mode = true ; // hold sending normal DATA self . timed_event_handler . as_mut ( ) . unwrap ( ) . set_timeout ( & chronoDuration :: from_std ( NACK_RESPONSE_DELAY ) . unwrap ( ) , TimerMessageType :: WriterSendRepairData { to_reader : reader_guid } , ) ; } } }
When receiving an ACKNACK Message indicating a Reader is missing some data samples, the Writer must
respond by either sending the missing data samples, sending a GAP message when the sample is not relevant, or
sending a HEARTBEAT message when the sample is no longer available
When receiving an ACKNACK Message indicating a Reader is missing some data samples the Writer must respond by either sending the missing data samples sending a GAP message when the sample is not relevant or sending a HEARTBEAT message when the sample is no longer available
&mut self
reader_guid_prefix
GuidPrefix
an
AckNack