From 4a8e111a185aef1daf0232bce9784e10199716ba Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jun 2023 17:44:18 +0200 Subject: [PATCH 1/4] bugfix packet demux --- mission/tmtc/PusLiveDemux.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mission/tmtc/PusLiveDemux.cpp b/mission/tmtc/PusLiveDemux.cpp index bbe1be4f..28114252 100644 --- a/mission/tmtc/PusLiveDemux.cpp +++ b/mission/tmtc/PusLiveDemux.cpp @@ -10,7 +10,10 @@ ReturnValue_t PusLiveDemux::demultiplexPackets(StorageManagerIF& tmStore, size_t tmSize) { ReturnValue_t result = returnvalue::OK; for (unsigned int idx = 0; idx < destinations.size(); idx++) { + sif::debug << "Destination size: " << destinations.size() << std::endl; + sif::debug << "Sending" << destinations[idx].name << std::endl; const auto& dest = destinations[idx]; + bool setOrigStoreId = false; 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 @@ -26,8 +29,14 @@ ReturnValue_t PusLiveDemux::demultiplexPackets(StorageManagerIF& tmStore, #endif } } else { - message.setStorageId(origStoreId); + setOrigStoreId = true; + sif::debug << "Setting org store ID" << std::endl; } + } else { + setOrigStoreId = true; + } + if(setOrigStoreId) { + message.setStorageId(origStoreId); } result = ownerQueue.sendMessage(dest.queueId, &message); if (result != returnvalue::OK) { -- 2.43.0 From db5e7a535eae18fe82ddf2db8abcfaafc72ddf91 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jun 2023 17:47:18 +0200 Subject: [PATCH 2/4] remove printouts --- mission/tmtc/PusLiveDemux.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mission/tmtc/PusLiveDemux.cpp b/mission/tmtc/PusLiveDemux.cpp index 28114252..47e1fc1f 100644 --- a/mission/tmtc/PusLiveDemux.cpp +++ b/mission/tmtc/PusLiveDemux.cpp @@ -10,8 +10,6 @@ ReturnValue_t PusLiveDemux::demultiplexPackets(StorageManagerIF& tmStore, size_t tmSize) { ReturnValue_t result = returnvalue::OK; for (unsigned int idx = 0; idx < destinations.size(); idx++) { - sif::debug << "Destination size: " << destinations.size() << std::endl; - sif::debug << "Sending" << destinations[idx].name << std::endl; const auto& dest = destinations[idx]; bool setOrigStoreId = false; if (destinations.size() > 1) { @@ -30,13 +28,12 @@ ReturnValue_t PusLiveDemux::demultiplexPackets(StorageManagerIF& tmStore, } } else { setOrigStoreId = true; - sif::debug << "Setting org store ID" << std::endl; } } else { setOrigStoreId = true; } - if(setOrigStoreId) { - message.setStorageId(origStoreId); + if (setOrigStoreId) { + message.setStorageId(origStoreId); } result = ownerQueue.sendMessage(dest.queueId, &message); if (result != returnvalue::OK) { -- 2.43.0 From b261779ebf79c45ce45bae3057eb70a43e8d20bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jun 2023 17:53:19 +0200 Subject: [PATCH 3/4] this iis less confusing --- mission/tmtc/PusLiveDemux.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/mission/tmtc/PusLiveDemux.cpp b/mission/tmtc/PusLiveDemux.cpp index 47e1fc1f..8ba69e07 100644 --- a/mission/tmtc/PusLiveDemux.cpp +++ b/mission/tmtc/PusLiveDemux.cpp @@ -11,28 +11,19 @@ ReturnValue_t PusLiveDemux::demultiplexPackets(StorageManagerIF& tmStore, ReturnValue_t result = returnvalue::OK; for (unsigned int idx = 0; idx < destinations.size(); idx++) { const auto& dest = destinations[idx]; - bool setOrigStoreId = false; - 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, tmData, tmSize); - if (result == returnvalue::OK) { - message.setStorageId(storeId); - } else { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PusLiveDemux::handlePacket: Store too full to create data copy" - << std::endl; -#endif - } + if ((destinations.size() > 1) and (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, tmData, tmSize); + if (result == returnvalue::OK) { + message.setStorageId(storeId); } else { - setOrigStoreId = true; +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "PusLiveDemux::handlePacket: Store too full to create data copy" << std::endl; +#endif } } else { - setOrigStoreId = true; - } - if (setOrigStoreId) { message.setStorageId(origStoreId); } result = ownerQueue.sendMessage(dest.queueId, &message); -- 2.43.0 From a95ab49690e5302657924e51c9fb4522e343772f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jun 2023 17:56:54 +0200 Subject: [PATCH 4/4] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53ccf1d5..c918c5e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v4.0.1] 2023-06-23 + +## Fixed + +- `PusLiveDemux` packet demultiplexing bugfix where the demultiplexing did not work when there was + only one destination available. + # [v4.0.0] 2023-06-22 - `eive-tmtc` version v5.0.0 -- 2.43.0