This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22703 ) Change subject: NS_Emulation: Avoid g_unblocked_nsvcs_* overflowing ...................................................................... NS_Emulation: Avoid g_unblocked_nsvcs_* overflowing Sometimes we run into situations where the g_unblocked_nsvcs_* is exceeding the number of NSVCs we have in g_nsvcs. This can only happen as we blindly append integers to the ro_integer fields, rather than checking if they are already contained. Let's factor out the add_unique and del functions (in Osmocom_Types) and use them from NS_Emulation. Change-Id: Ib3273d6ce9b80f700c964d578fdb0f268eac6a14 --- M library/NS_Emulation.ttcnpp M library/Osmocom_Types.ttcn 2 files changed, 23 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/03/22703/1 diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp index ca44a02..6d8113c 100644 --- a/library/NS_Emulation.ttcnpp +++ b/library/NS_Emulation.ttcnpp @@ -310,30 +310,16 @@ /* add index to list of unblocked NSVCs */ if (not ischosen(g_nsvcs[i].cfg.provider.ip) or g_nsvcs[i].cfg.provider.ip.signalling_weight > 0) { - g_unblocked_nsvcs_sig := g_unblocked_nsvcs_sig & {i}; + ro_integer_add_unique(g_unblocked_nsvcs_sig, i); } if (not ischosen(g_nsvcs[i].cfg.provider.ip) or g_nsvcs[i].cfg.provider.ip.data_weight > 0) { - g_unblocked_nsvcs_data := g_unblocked_nsvcs_data & {i}; + ro_integer_add_unique(g_unblocked_nsvcs_data, i); } } else if (g_nsvcs[i].state == NSVC_S_ALIVE_UNBLOCKED and state != NSVC_S_ALIVE_UNBLOCKED) { /* remove index to list of unblocked NSVCs */ - var Osmocom_Types.ro_integer new_unblocked_nsvcs_sig := {}; - for (var integer j := 0; j < lengthof(g_unblocked_nsvcs_sig); j := j+1) { - if (g_unblocked_nsvcs_sig[j] != i) { - new_unblocked_nsvcs_sig := new_unblocked_nsvcs_sig & {j}; - } - } - g_unblocked_nsvcs_sig := new_unblocked_nsvcs_sig; - - var Osmocom_Types.ro_integer new_unblocked_nsvcs_data := {}; - for (var integer j := 0; j < lengthof(g_unblocked_nsvcs_data); j := j+1) { - if (g_unblocked_nsvcs_data[j] != i) { - new_unblocked_nsvcs_data := new_unblocked_nsvcs_data & {j}; - } - } - g_unblocked_nsvcs_data := new_unblocked_nsvcs_data; - + ro_integer_del(g_unblocked_nsvcs_sig, i); + ro_integer_del(g_unblocked_nsvcs_data, i); } g_nsvcs[i].state := state; } diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn index 06920bf..23f8fd9 100644 --- a/library/Osmocom_Types.ttcn +++ b/library/Osmocom_Types.ttcn @@ -294,6 +294,25 @@ return false; } +function ro_integer_add_unique(inout ro_integer roi, integer new_entry) +{ + if (ro_integer_contains(roi, new_entry)) { + return; + } + roi := roi & {new_entry}; +} + +function ro_integer_del(inout ro_integer roi, integer del_entry) +{ + var ro_integer tmp := {}; + for (var integer j := 0; j < lengthof(roi); j := j+1) { + if (roi[j] != del_entry) { + tmp := tmp & { roi[j] }; + } + } + roi := tmp; +} + type record of ro_integer roro_integer; -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22703 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ib3273d6ce9b80f700c964d578fdb0f268eac6a14 Gerrit-Change-Number: 22703 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210204/74bd2b8d/attachment.htm>