refactored TM funnels to allow multiple TM recipients #312

Merged
meierj merged 5 commits from mueller/tm_funnel_improvements into develop 2022-11-02 13:10:43 +01:00
2 changed files with 20 additions and 16 deletions
Showing only changes of commit 14b8b00880 - Show all commits

View File

@ -69,14 +69,16 @@ ReturnValue_t CfdpTmFunnel::handlePacket(TmTcMessage& msg) {
store_address_t origStoreId = newStoreId; store_address_t origStoreId = newStoreId;
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 (idx <= destinations.size() - 1) { if (destinations.size() > 1) {
// Create copy of data to ensure each TM recipient has its own copy. That way, we don't need if (idx <= destinations.size() - 1) {
// to bother with send order and where the data is deleted. // Create copy of data to ensure each TM recipient has its own copy. That way, we don't need
store_address_t storeId; // to bother with send order and where the data is deleted.
result = tmStore.addData(&storeId, newPacketData, serSize); store_address_t storeId;
msg.setStorageId(storeId); result = tmStore.addData(&storeId, newPacketData, serSize);
} else { msg.setStorageId(storeId);
msg.setStorageId(origStoreId); } else {
msg.setStorageId(origStoreId);
}
} }
result = tmQueue->sendMessage(destVcidPair.first, &msg); result = tmQueue->sendMessage(destVcidPair.first, &msg);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {

View File

@ -50,14 +50,16 @@ 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 (idx <= destinations.size() - 1) { if (destinations.size() > 1) {
// Create copy of data to ensure each TM recipient has its own copy. That way, we don't need if (idx <= destinations.size() - 1) {
// to bother with send order and where the data is deleted. // Create copy of data to ensure each TM recipient has its own copy. That way, we don't need
store_address_t storeId; // to bother with send order and where the data is deleted.
result = tmStore.addData(&storeId, packetData, size); store_address_t storeId;
message.setStorageId(storeId); result = tmStore.addData(&storeId, packetData, size);
} else { message.setStorageId(storeId);
message.setStorageId(origStoreId); } else {
message.setStorageId(origStoreId);
}
} }
result = tmQueue->sendMessage(destVcidPair.first, &message); result = tmQueue->sendMessage(destVcidPair.first, &message);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {