important bugfix

This commit is contained in:
Robin Müller 2022-11-03 15:29:54 +01:00
parent b742f91ea8
commit 89083cdbc8
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 18 additions and 4 deletions

View File

@ -70,12 +70,19 @@ ReturnValue_t CfdpTmFunnel::handlePacket(TmTcMessage& msg) {
for (unsigned int idx = 0; idx < destinations.size(); idx++) { for (unsigned int idx = 0; idx < destinations.size(); idx++) {
const auto& destVcidPair = destinations[idx]; const auto& destVcidPair = destinations[idx];
if (destinations.size() > 1) { 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 // 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. // to bother with send order and where the data is deleted.
store_address_t storeId; store_address_t storeId;
result = tmStore.addData(&storeId, newPacketData, serSize); 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 { } else {
msg.setStorageId(origStoreId); msg.setStorageId(origStoreId);
} }

View File

@ -51,12 +51,19 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) {
for (unsigned int idx = 0; idx < destinations.size(); idx++) { for (unsigned int idx = 0; idx < destinations.size(); idx++) {
const auto &destVcidPair = destinations[idx]; const auto &destVcidPair = destinations[idx];
if (destinations.size() > 1) { 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 // 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. // to bother with send order and where the data is deleted.
store_address_t storeId; store_address_t storeId;
result = tmStore.addData(&storeId, packetData, size); 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 { } else {
message.setStorageId(origStoreId); message.setStorageId(origStoreId);
} }