From 14b8b00880fbf87516604179b44367692691696b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 2 Nov 2022 10:55:40 +0100 Subject: [PATCH] small logic fix --- mission/tmtc/CfdpTmFunnel.cpp | 18 ++++++++++-------- mission/tmtc/PusTmFunnel.cpp | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/mission/tmtc/CfdpTmFunnel.cpp b/mission/tmtc/CfdpTmFunnel.cpp index 0c003881..33ecc034 100644 --- a/mission/tmtc/CfdpTmFunnel.cpp +++ b/mission/tmtc/CfdpTmFunnel.cpp @@ -69,14 +69,16 @@ ReturnValue_t CfdpTmFunnel::handlePacket(TmTcMessage& msg) { store_address_t origStoreId = newStoreId; for (unsigned int idx = 0; idx < destinations.size(); idx++) { const auto& destVcidPair = destinations[idx]; - 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); - } else { - msg.setStorageId(origStoreId); + if (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); + } else { + msg.setStorageId(origStoreId); + } } result = tmQueue->sendMessage(destVcidPair.first, &msg); if (result != returnvalue::OK) { diff --git a/mission/tmtc/PusTmFunnel.cpp b/mission/tmtc/PusTmFunnel.cpp index dcf56f18..a776e6b9 100644 --- a/mission/tmtc/PusTmFunnel.cpp +++ b/mission/tmtc/PusTmFunnel.cpp @@ -50,14 +50,16 @@ ReturnValue_t PusTmFunnel::handlePacket(TmTcMessage &message) { for (unsigned int idx = 0; idx < destinations.size(); idx++) { const auto &destVcidPair = destinations[idx]; - 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); - } else { - message.setStorageId(origStoreId); + if (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); + } else { + message.setStorageId(origStoreId); + } } result = tmQueue->sendMessage(destVcidPair.first, &message); if (result != returnvalue::OK) {