continue dest handler

This commit is contained in:
Robin Mueller
2025-09-23 17:55:02 +02:00
parent d1bdf66974
commit eff6043490
3 changed files with 435 additions and 151 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1112,6 +1112,7 @@ pub(crate) mod tests {
pub(crate) struct TimerExpiryControl { pub(crate) struct TimerExpiryControl {
pub(crate) check_limit: Arc<AtomicBool>, pub(crate) check_limit: Arc<AtomicBool>,
pub(crate) positive_ack: Arc<AtomicBool>, pub(crate) positive_ack: Arc<AtomicBool>,
pub(crate) nak_activity: Arc<AtomicBool>,
} }
impl TimerExpiryControl { impl TimerExpiryControl {
@@ -1149,7 +1150,10 @@ pub(crate) mod tests {
.expiry_control .expiry_control
.positive_ack .positive_ack
.load(core::sync::atomic::Ordering::Acquire), .load(core::sync::atomic::Ordering::Acquire),
TimerContext::NakActivity { expiry_time: _ } => todo!(), TimerContext::NakActivity { expiry_time: _ } => self
.expiry_control
.nak_activity
.load(core::sync::atomic::Ordering::Acquire),
} }
} }
fn reset(&mut self) { fn reset(&mut self) {
@@ -1162,7 +1166,10 @@ pub(crate) mod tests {
.expiry_control .expiry_control
.check_limit .check_limit
.store(false, core::sync::atomic::Ordering::Release), .store(false, core::sync::atomic::Ordering::Release),
TimerContext::NakActivity { expiry_time: _ } => todo!(), TimerContext::NakActivity { expiry_time: _ } => self
.expiry_control
.nak_activity
.store(false, core::sync::atomic::Ordering::Release),
TimerContext::PositiveAck { expiry_time: _ } => self TimerContext::PositiveAck { expiry_time: _ } => self
.expiry_control .expiry_control
.positive_ack .positive_ack
@@ -1205,8 +1212,8 @@ pub(crate) mod tests {
TimerContext::PositiveAck { expiry_time: _ } => { TimerContext::PositiveAck { expiry_time: _ } => {
TestCheckTimer::new(timer_context, &self.expiry_control) TestCheckTimer::new(timer_context, &self.expiry_control)
} }
_ => { TimerContext::NakActivity { expiry_time: _ } => {
panic!("invalid check timer creator, can only be used for check limit handling") TestCheckTimer::new(timer_context, &self.expiry_control)
} }
} }
} }
@@ -1527,7 +1534,7 @@ pub(crate) mod tests {
fn generic_pdu_header() -> PduHeader { fn generic_pdu_header() -> PduHeader {
let pdu_conf = CommonPduConfig::default(); let pdu_conf = CommonPduConfig::default();
PduHeader::new_no_file_data(pdu_conf, 0) PduHeader::new_for_file_directive(pdu_conf, 0)
} }
#[test] #[test]

View File

@@ -831,7 +831,7 @@ impl<
transaction_status: TransactionStatus, transaction_status: TransactionStatus,
) -> Result<(), SourceError> { ) -> Result<(), SourceError> {
let ack_pdu = AckPdu::new( let ack_pdu = AckPdu::new(
PduHeader::new_no_file_data(self.pdu_conf, 0), PduHeader::new_for_file_directive(self.pdu_conf, 0),
FileDirectiveType::FinishedPdu, FileDirectiveType::FinishedPdu,
condition_code, condition_code,
transaction_status, transaction_status,
@@ -850,7 +850,7 @@ impl<
); );
if self.file_params.metadata_only { if self.file_params.metadata_only {
let metadata_pdu = MetadataPduCreator::new( let metadata_pdu = MetadataPduCreator::new(
PduHeader::new_no_file_data(self.pdu_conf, 0), PduHeader::new_for_file_directive(self.pdu_conf, 0),
metadata_params, metadata_params,
Lv::new_empty(), Lv::new_empty(),
Lv::new_empty(), Lv::new_empty(),
@@ -859,7 +859,7 @@ impl<
return self.pdu_send_helper(&metadata_pdu); return self.pdu_send_helper(&metadata_pdu);
} }
let metadata_pdu = MetadataPduCreator::new( let metadata_pdu = MetadataPduCreator::new(
PduHeader::new_no_file_data(self.pdu_conf, 0), PduHeader::new_for_file_directive(self.pdu_conf, 0),
metadata_params, metadata_params,
Lv::new_from_str(self.put_request_cacher.source_file().unwrap()).unwrap(), Lv::new_from_str(self.put_request_cacher.source_file().unwrap()).unwrap(),
Lv::new_from_str(self.put_request_cacher.dest_file().unwrap()).unwrap(), Lv::new_from_str(self.put_request_cacher.dest_file().unwrap()).unwrap(),
@@ -918,7 +918,7 @@ impl<
fn calculate_max_file_seg_len(&self, remote_cfg: &RemoteEntityConfig) -> u64 { fn calculate_max_file_seg_len(&self, remote_cfg: &RemoteEntityConfig) -> u64 {
let mut derived_max_seg_len = calculate_max_file_seg_len_for_max_packet_len_and_pdu_header( let mut derived_max_seg_len = calculate_max_file_seg_len_for_max_packet_len_and_pdu_header(
&PduHeader::new_no_file_data(self.pdu_conf, 0), &PduHeader::new_for_file_directive(self.pdu_conf, 0),
remote_cfg.max_packet_len, remote_cfg.max_packet_len,
None, None,
); );
@@ -983,7 +983,7 @@ impl<
checksum: u32, checksum: u32,
) -> Result<(), SourceError> { ) -> Result<(), SourceError> {
let eof_pdu = EofPdu::new( let eof_pdu = EofPdu::new(
PduHeader::new_no_file_data(self.pdu_conf, 0), PduHeader::new_for_file_directive(self.pdu_conf, 0),
self.tstate_ref() self.tstate_ref()
.cond_code_eof .cond_code_eof
.get() .get()
@@ -1643,7 +1643,7 @@ mod tests {
// Finish handling: Simulate completion from the destination side by insert finished PDU. // Finish handling: Simulate completion from the destination side by insert finished PDU.
fn finish_handling(&mut self, user: &mut TestCfdpUser, transfer_info: &TransferInfo) { fn finish_handling(&mut self, user: &mut TestCfdpUser, transfer_info: &TransferInfo) {
let finished_pdu = FinishedPduCreator::new_default( let finished_pdu = FinishedPduCreator::new_no_error(
transfer_info.pdu_header, transfer_info.pdu_header,
DeliveryCode::Complete, DeliveryCode::Complete,
FileStatus::Retained, FileStatus::Retained,