refactored throttle handling
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
2023-10-13 10:57:58 +02:00
parent 031be000d4
commit 9f600a24ff
6 changed files with 37 additions and 21 deletions

View File

@ -15,7 +15,8 @@
using namespace returnvalue;
using namespace cfdp;
CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwHandlerParams, const CfdpHandlerCfg& cfdpCfg)
CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwHandlerParams, const CfdpHandlerCfg& cfdpCfg,
const std::atomic_bool& throttleSignal)
: SystemObject(fsfwHandlerParams.objectId),
pduQueue(fsfwHandlerParams.tmtcQueue),
cfdpRequestQueue(fsfwHandlerParams.cfdpQueue),
@ -28,7 +29,8 @@ CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwHandlerParams, const CfdpH
this->fsfwParams),
srcHandler(SourceHandlerParams(localCfg, cfdpCfg.userHandler, seqCntProvider),
this->fsfwParams),
ipcStore(fsfwHandlerParams.ipcStore) {}
ipcStore(fsfwHandlerParams.ipcStore),
throttleSignal(throttleSignal) {}
[[nodiscard]] const char* CfdpHandler::getName() const { return "CFDP Handler"; }
@ -69,20 +71,11 @@ ReturnValue_t CfdpHandler::initialize() {
fsmCount++;
}
fsmCount = 0;
if (signals::CFDP_CHANNEL_THROTTLE_SIGNAL) {
throttlePeriodSourceHandler.resetTimer();
if (throttleSignal) {
throttlePeriodOngoing = true;
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = false;
}
if (throttlePeriodOngoing) {
if (throttlePeriodSourceHandler.hasTimedOut()) {
throttlePeriodOngoing = false;
} else {
shortDelay = true;
}
}
// CFDP can be throttled by the slowest live TM handler to handle back pressure in a sensible
// way without requiring huge amounts of memory for large files.
if (!throttlePeriodOngoing) {