From 34aaeb3407397a5d9d5d537f80dc4e854b70cde3 Mon Sep 17 00:00:00 2001 From: Levente Meszaros Date: Tue, 26 Mar 2024 10:36:12 +0100 Subject: [PATCH] StreamRedundancyConfigurator: Changed assignedVlanIds handling to be more strict. When new entries are inserted there should be none. Also, when an entry is looked up, it should already be there. --- .../configurator/common/StreamRedundancyConfigurator.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/inet/linklayer/configurator/common/StreamRedundancyConfigurator.cc b/src/inet/linklayer/configurator/common/StreamRedundancyConfigurator.cc index 715d8eeb4d7..8fe12711a68 100644 --- a/src/inet/linklayer/configurator/common/StreamRedundancyConfigurator.cc +++ b/src/inet/linklayer/configurator/common/StreamRedundancyConfigurator.cc @@ -182,7 +182,9 @@ void StreamRedundancyConfigurator::computeStreamEncodings(cValueMap *streamConfi for (size_t k = 0; k < receiverNetworkNodeNames.size(); k++) { auto receiverNetworkNodeName = receiverNetworkNodeNames[k]; EV_DEBUG << "Assigning VLAN id" << EV_FIELD(streamName) << EV_FIELD(networkNodeName) << EV_FIELD(receiverNetworkNodeName) << EV_FIELD(destinationAddress) << EV_FIELD(vlanId) << EV_ENDL; - assignedVlanIds[{networkNodeName, receiverNetworkNodeName, destinationAddress, streamName}] = vlanId; + std::tuple key = {networkNodeName, receiverNetworkNodeName, destinationAddress, streamName}; + ASSERT(assignedVlanIds.find(key) == assignedVlanIds.end()); + assignedVlanIds[key] = vlanId; StreamEncoding streamEncoding; streamEncoding.name = outputStreamName; streamEncoding.networkInterface = streamNode.interfaces[j][k]; @@ -217,7 +219,7 @@ void StreamRedundancyConfigurator::computeStreamPolicyConfigurations(cValueMap * for (auto senderNetworkNodeName : streamNode.senders) { auto inputStreamName = streamNode.senders.size() == 1 ? streamName : streamName + "_" + senderNetworkNodeName; auto linkIn = findLinkIn(node, senderNetworkNodeName.c_str()); - auto vlanId = assignedVlanIds[{senderNetworkNodeName, networkNodeName, destinationAddress, streamName}]; + auto vlanId = assignedVlanIds.at({senderNetworkNodeName, networkNodeName, destinationAddress, streamName}); StreamDecoding streamDecoding; streamDecoding.name = inputStreamName; streamDecoding.networkInterface = linkIn->destinationInterface->networkInterface;