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

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 26 21:37:48 UTC 2018


Review at  https://gerrit.osmocom.org/6956

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/56/6956/1

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: newchange
Gerrit-Change-Id: Iee83b4905cce3a84eb007ffd189b55f4b54f7cb6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list