From 89083cdbc8886bb445ecae922f6ac3f09e9ea49d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 3 Nov 2022 15:29:54 +0100 Subject: [PATCH] important bugfix --- mission/tmtc/CfdpTmFunnel.cpp | 11 +++++++++-- mission/tmtc/PusTmFunnel.cpp | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mission/tmtc/CfdpTmFunnel.cpp b/mission/tmtc/CfdpTmFunnel.cpp index f62e68e3..aff7c95d 100644 --- a/mission/tmtc/CfdpTmFunnel.cpp +++ b/mission/tmtc/CfdpTmFunnel.cpp @@ -70,12 +70,19 @@ ReturnValue_t CfdpTmFunnel::handlePacket(TmTcMessage& msg) { for (unsigned int idx = 0; idx < destinations.size(); idx++) { const auto& destVcidPair = destinations[idx]; if (destinations.size() > 1) { - if (idx <= destinations.size() - 1) { + if (idx < destinations.size() - 1) { // Create copy of data to ensure each TM recipient has its own copy. That way, we don't need // to bother with send order and where the data is deleted. store_address_t storeId; result = tmStore.addData(&storeId, newPacketData, serSize); - msg.setStorageId(storeId); + if (result == returnvalue::OK) { + msg.setStorageId(storeId); + } else { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "PusTmFunnel::handlePacket: Store too full to create data copy" + << std::endl; +#endif + } } else { msg.setStorageId(origStoreId); } diff --git a/mission/tmtc/PusTmFunnel.cpp b/mission/tmtc/PusTmFunnel.cpp index a776e6b9..5d6bbb4d 100644 --- a/mission/tmtc/PusTmFunnel.cpp +++ b/mission/tmtc/PusTmFunnel.cpp @@ -51,12 +51,19 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) { for (unsigned int idx = 0; idx < destinations.size(); idx++) { const auto &destVcidPair = destinations[idx]; if (destinations.size() > 1) { - if (idx <= destinations.size() - 1) { + if (idx < destinations.size() - 1) { // Create copy of data to ensure each TM recipient has its own copy. That way, we don't need // to bother with send order and where the data is deleted. store_address_t storeId; result = tmStore.addData(&storeId, packetData, size); - message.setStorageId(storeId); + if (result == returnvalue::OK) { + message.setStorageId(storeId); + } else { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "PusTmFunnel::handlePacket: Store too full to create data copy" + << std::endl; +#endif + } } else { message.setStorageId(origStoreId); }