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