Change in osmo-ttcn3-hacks[master]: Iuh_Emulation: Avoid sending events to HNBAP if socket is not connected

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.org
Thu Dec 23 14:51:29 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26677 )

Change subject: Iuh_Emulation: Avoid sending events to HNBAP if socket is not connected
......................................................................

Iuh_Emulation: Avoid sending events to HNBAP if socket is not connected

This should hopefully fix HNB_Tests errors showing up in jenkins after
the test finishes:
Iuh_Emulation.ttcn:203 Dynamic test case error: Port HNBAP has neither connections nor mappings. Message cannot be sent on it.

Change-Id: Ide201425e81dcfe2fd395d820bdcbd74f5415ef5
---
M library/Iuh_Emulation.ttcn
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/library/Iuh_Emulation.ttcn b/library/Iuh_Emulation.ttcn
index 75a95ba..bc8e7c3 100644
--- a/library/Iuh_Emulation.ttcn
+++ b/library/Iuh_Emulation.ttcn
@@ -128,6 +128,12 @@
 	return conn_id;
 }
 
+private function f_send_IUHEM_Event(template (value) IUHEM_Event evt) runs on Iuh_Emulation_CT {
+	if (HNBAP.checkstate("Connected")) {
+		HNBAP.send(evt);
+	}
+}
+
 function main(Iuh_conn_parameters p, charstring id) runs on Iuh_Emulation_CT {
 	var Result res;
 	g_pars := p;
@@ -147,7 +153,7 @@
 
 	/* notify user about SCTP establishment */
 	if (p.remote_sctp_port != -1) {
-		HNBAP.send(IUHEM_Event:{up_down:=IUHEM_EVENT_UP});
+		f_send_IUHEM_Event(IUHEM_Event:{up_down:=IUHEM_EVENT_UP});
 	}
 
 	while (true) {
@@ -194,13 +200,13 @@
 			g_last_conn_id := asp_evt.connOpened.connId;
 			log("Established a new Iuh connection (conn_id=", g_last_conn_id, ")");
 
-			HNBAP.send(IUHEM_Event:{up_down:=IUHEM_EVENT_UP}); /* TODO: send g_last_conn_id */
+			f_send_IUHEM_Event(IUHEM_Event:{up_down:=IUHEM_EVENT_UP}); /* TODO: send g_last_conn_id */
 		}
 
 		[] Iuh.receive(ASP_Event:{connClosed:=?}) -> value asp_evt {
 			log("Iuh: Closed");
 			g_self_conn_id := -1;
-			HNBAP.send(IUHEM_Event:{up_down:=IUHEM_EVENT_DOWN});  /* TODO: send asp_evt.connClosed.connId */
+			f_send_IUHEM_Event(IUHEM_Event:{up_down:=IUHEM_EVENT_DOWN});  /* TODO: send asp_evt.connClosed.connId */
 			if (not emu_is_server()) {
 				self.stop;
 			}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26677
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: Ide201425e81dcfe2fd395d820bdcbd74f5415ef5
Gerrit-Change-Number: 26677
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211223/d59ebd6a/attachment.htm>


More information about the gerrit-log mailing list