better names
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good

This commit is contained in:
2024-04-29 23:43:28 +02:00
parent b675253222
commit 2cc7f03a05
3 changed files with 18 additions and 17 deletions

View File

@ -5,7 +5,7 @@ use satrs::pus::action::{
ActionReplyPus, ActionReplyVariant, ActivePusActionRequestStd, DefaultActiveActionRequestMap, ActionReplyPus, ActionReplyVariant, ActivePusActionRequestStd, DefaultActiveActionRequestMap,
}; };
use satrs::pus::verification::{ use satrs::pus::verification::{
handle_completion_failure_with_error_as_params, handle_step_failure_with_error_as_params, handle_completion_failure_with_generic_params, handle_step_failure_with_generic_params,
FailParamHelper, FailParams, TcStateAccepted, TcStateStarted, VerificationReporter, FailParamHelper, FailParams, TcStateAccepted, TcStateStarted, VerificationReporter,
VerificationReportingProvider, VerificationToken, VerificationReportingProvider, VerificationToken,
}; };
@ -69,7 +69,7 @@ impl PusReplyHandler<ActivePusActionRequestStd, ActionReplyPus> for ActionReplyH
.expect("invalid token state"); .expect("invalid token state");
let remove_entry = match &reply.message.variant { let remove_entry = match &reply.message.variant {
ActionReplyVariant::CompletionFailed { error_code, params } => { ActionReplyVariant::CompletionFailed { error_code, params } => {
let error_propagated = handle_completion_failure_with_error_as_params( let error_propagated = handle_completion_failure_with_generic_params(
tm_sender, tm_sender,
verif_token, verif_token,
verification_handler, verification_handler,
@ -93,7 +93,7 @@ impl PusReplyHandler<ActivePusActionRequestStd, ActionReplyPus> for ActionReplyH
step, step,
params, params,
} => { } => {
let error_propagated = handle_step_failure_with_error_as_params( let error_propagated = handle_step_failure_with_generic_params(
tm_sender, tm_sender,
verif_token, verif_token,
verification_handler, verification_handler,

View File

@ -439,20 +439,17 @@ where
return Ok(()); return Ok(());
} }
let active_request = active_req_opt.unwrap(); let active_request = active_req_opt.unwrap();
let request_finished = self let result = self.reply_handler.handle_reply(
.reply_handler
.handle_reply(
reply, reply,
active_request, active_request,
&self.service_helper.common.tm_sender, &self.service_helper.common.tm_sender,
&self.service_helper.common.verif_reporter, &self.service_helper.common.verif_reporter,
time_stamp, time_stamp,
) );
.unwrap_or(false); if result.is_err() || (result.is_ok() && *result.as_ref().unwrap()) {
if request_finished {
self.active_request_map.remove(reply.request_id()); self.active_request_map.remove(reply.request_id());
} }
Ok(()) result.map(|_| ())
} }
pub fn check_for_request_timeouts(&mut self) { pub fn check_for_request_timeouts(&mut self) {

View File

@ -1190,7 +1190,7 @@ pub struct FailParamHelper<'stamp, 'fargs, 'buf, 'params> {
/// This function also might not be able to propagate other error variants which are added in /// This function also might not be able to propagate other error variants which are added in
/// the future. The returned boolean on success denotes whether the error parameters were /// the future. The returned boolean on success denotes whether the error parameters were
/// propagated properly. /// propagated properly.
pub fn handle_completion_failure_with_error_as_params<TcState: WasAtLeastAccepted + Copy>( pub fn handle_completion_failure_with_generic_params<TcState: WasAtLeastAccepted + Copy>(
tm_sender: &(impl EcssTmSender + ?Sized), tm_sender: &(impl EcssTmSender + ?Sized),
verif_token: VerificationToken<TcState>, verif_token: VerificationToken<TcState>,
verif_reporter: &impl VerificationReportingProvider, verif_reporter: &impl VerificationReportingProvider,
@ -1220,6 +1220,7 @@ pub fn handle_completion_failure_with_error_as_params<TcState: WasAtLeastAccepte
), ),
)?; )?;
} }
#[cfg(feature = "alloc")]
Params::Vec(vec) => { Params::Vec(vec) => {
verif_reporter.completion_failure( verif_reporter.completion_failure(
tm_sender, tm_sender,
@ -1227,6 +1228,7 @@ pub fn handle_completion_failure_with_error_as_params<TcState: WasAtLeastAccepte
FailParams::new(helper.timestamp, helper.error_code, vec), FailParams::new(helper.timestamp, helper.error_code, vec),
)?; )?;
} }
#[cfg(feature = "alloc")]
Params::String(str) => { Params::String(str) => {
verif_reporter.completion_failure( verif_reporter.completion_failure(
tm_sender, tm_sender,
@ -1248,7 +1250,7 @@ pub fn handle_completion_failure_with_error_as_params<TcState: WasAtLeastAccepte
/// This function is similar to [handle_completion_failure_with_error_as_params] but handles the /// This function is similar to [handle_completion_failure_with_error_as_params] but handles the
/// step failure case. /// step failure case.
pub fn handle_step_failure_with_error_as_params( pub fn handle_step_failure_with_generic_params(
tm_sender: &(impl EcssTmSender + ?Sized), tm_sender: &(impl EcssTmSender + ?Sized),
verif_token: VerificationToken<TcStateStarted>, verif_token: VerificationToken<TcStateStarted>,
verif_reporter: &impl VerificationReportingProvider, verif_reporter: &impl VerificationReportingProvider,
@ -1280,6 +1282,7 @@ pub fn handle_step_failure_with_error_as_params(
), ),
)?; )?;
} }
#[cfg(feature = "alloc")]
Params::Vec(vec) => { Params::Vec(vec) => {
verif_reporter.step_failure( verif_reporter.step_failure(
tm_sender, tm_sender,
@ -1287,6 +1290,7 @@ pub fn handle_step_failure_with_error_as_params(
FailParamsWithStep::new(helper.timestamp, step, helper.error_code, vec), FailParamsWithStep::new(helper.timestamp, step, helper.error_code, vec),
)?; )?;
} }
#[cfg(feature = "alloc")]
Params::String(str) => { Params::String(str) => {
verif_reporter.step_failure( verif_reporter.step_failure(
tm_sender, tm_sender,