From 40c8c36af356c5c03fbeccb6ae84954397be6aea Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 2 Sep 2023 23:52:50 +0200 Subject: [PATCH] added eof creation --- satrs-core/src/cfdp/dest.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/satrs-core/src/cfdp/dest.rs b/satrs-core/src/cfdp/dest.rs index a15b32d..8b70660 100644 --- a/satrs-core/src/cfdp/dest.rs +++ b/satrs-core/src/cfdp/dest.rs @@ -733,6 +733,14 @@ mod tests { panic!("destination handler packet insertion error: {e}"); } - // TODO: Send EOF PDU and verify completion of transaction + let mut digest = CRC_32.digest(); + digest.update(file_data); + let crc32 = digest.finalize(); + let eof_pdu = EofPdu::new_no_error(pdu_header, crc32, file_data.len() as u64); + let result = eof_pdu.write_to_bytes(&mut buf); + assert!(result.is_ok()); + let packet_info = PacketInfo::new(&buf).expect("generating packet info failed"); + let result = dest_handler.insert_packet(&packet_info); + assert!(result.is_ok()); } }