diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-12-23 15:11:05 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-12-23 15:12:47 +0100 |
commit | 066f46f9d678835444ea78a546f0b1f983e48bc2 (patch) | |
tree | cb3639d73e59c959f5f1575e32c2ecb2d71ae4a9 | |
parent | 4a8c45f0ac7748306e357e365aca600fdda14849 (diff) |
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
-rw-r--r-- | library/Iuh_Emulation.ttcn | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/library/Iuh_Emulation.ttcn b/library/Iuh_Emulation.ttcn index 75a95ba8..bc8e7c33 100644 --- a/library/Iuh_Emulation.ttcn +++ b/library/Iuh_Emulation.ttcn @@ -128,6 +128,12 @@ return IPL4asp_Types.ConnectionId { 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 @@ function main(Iuh_conn_parameters p, charstring id) runs on Iuh_Emulation_CT { /* 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 @@ function main(Iuh_conn_parameters p, charstring id) runs on Iuh_Emulation_CT { 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; } |