now its getting tricky again
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2023-08-10 23:05:55 +02:00
parent 05391bbafe
commit c8c18c54df
Signed by: muellerr
GPG Key ID: 407F9B00F858F270

View File

@ -149,7 +149,7 @@ impl DestinationHandler {
return Ok(None);
}
let directive = self.packets_to_send_ctx.directive.unwrap();
let mut writte_size = 0;
let mut written_size = 0;
match directive {
FileDirectiveType::EofPdu => todo!(),
FileDirectiveType::FinishedPdu => {
@ -175,7 +175,7 @@ impl DestinationHandler {
entity_id,
)
};
writte_size = finished_pdu.write_to_bytes(buf)?;
written_size = finished_pdu.write_to_bytes(buf)?;
}
FileDirectiveType::AckPdu => todo!(),
FileDirectiveType::MetadataPdu => todo!(),
@ -183,7 +183,7 @@ impl DestinationHandler {
FileDirectiveType::PromptPdu => todo!(),
FileDirectiveType::KeepAlivePdu => todo!(),
}
Ok(Some((directive, writte_size)))
Ok(Some((directive, written_size)))
}
pub fn handle_file_directive(
@ -292,23 +292,21 @@ impl DestinationHandler {
}
fn fsm_nacked(&mut self) -> Result<(), DestError> {
match self.step {
TransactionStep::Idle => {
// TODO: Should not happen. Determine what to do later
}
TransactionStep::TransactionStart => {
if self.step == TransactionStep::Idle {}
if self.step == TransactionStep::TransactionStart {
self.transaction_start()?;
}
TransactionStep::ReceivingFileDataPdus => {
if self.step == TransactionStep::ReceivingFileDataPdus {
todo!("advance the fsm if everything is finished")
}
TransactionStep::TransferCompletion => {
if self.step == TransactionStep::TransferCompletion {
self.transfer_completion()?;
}
TransactionStep::SendingAckPdu => todo!(),
TransactionStep::SendingFinishedPdu => {
self.prepare_finished_pdu()?;
if self.step == TransactionStep::SendingAckPdu {
todo!();
}
if self.step == TransactionStep::SendingFinishedPdu {
return Ok(());
}
Ok(())
}
@ -355,13 +353,17 @@ impl DestinationHandler {
}
fn transfer_completion(&mut self) -> Result<(), DestError> {
todo!();
if self.transaction_params.metadata_params.closure_requested {
self.prepare_finished_pdu()?;
}
todo!("user indication");
Ok(())
}
fn prepare_finished_pdu(&mut self) -> Result<(), DestError> {
self.packets_to_send_ctx.packet_available = true;
self.packets_to_send_ctx.directive = Some(FileDirectiveType::FinishedPdu);
self.step = TransactionStep::SendingFinishedPdu;
Ok(())
}
}