[MERGED] osmo-ttcn3-hacks[master]: Add new f_timer_safe_restart() function for warning-safe res...

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Feb 27 21:39:08 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Add new f_timer_safe_restart() function for warning-safe restart
......................................................................


Add new f_timer_safe_restart() function for warning-safe restart

TITAN will print warnings if a still-running timer is res-started.
It will also warn if a not-started timer is stopped, so we need
a conditional stop + start if we want to avoid any warnings in a
convenient way.

Change-Id: Iee83b4905cce3a84eb007ffd189b55f4b54f7cb6
---
M bts/BTS_Tests.ttcn
M library/Osmocom_Types.ttcn
2 files changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 9cb0f72..8800139 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -544,8 +544,7 @@
 	alt {
 	[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) {
 		rsl_chrqd := rsl_chrqd + 1;
-		T.stop;
-		T.start;
+		f_timer_safe_restart(T);
 		repeat;
 		}
 	[] RSL_CCHAN.receive { repeat; }
@@ -732,7 +731,7 @@
 		/* increment counter of next to-be-expected meas rep */
 		g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256;
 		/* Re-start the timer expecting the next MEAS RES */
-		g_Tmeas_exp.start;
+		f_timer_safe_restart(g_Tmeas_exp);
 		repeat;
 		}
 	[] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value rsl {
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index a6d5c82..e36d2dc 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -118,5 +118,13 @@
 	return false;
 }
 
+/* re-start given timer in a warning-safe way: Stop (only if running) + start */
+function f_timer_safe_restart(timer T) {
+	if (T.running) {
+		T.stop;
+	}
+	T.start;
+}
+
 
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

-- 
To view, visit https://gerrit.osmocom.org/6956
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iee83b4905cce3a84eb007ffd189b55f4b54f7cb6
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list