RTP_Emulation: Fix race condition where Init is answered while connect is in progress

HNB test connects the RTP socket on the HNBGW side once it receives the
Audio-CONN_ESTABLISH.cnf with the ip+port info. However, while doing so,
osmo-hnodeb is already sending an Init which then the RTP_Emulation
(connection in progress) tries to answer with an Init-ACK.

RTP_Emulation.ttcn:201 Called on RTPEM_CTRL to TC_cs_mo_call-RTPEM(6) @RTP_Emulation.RTPEM_connect : { remote_host := "172.18.33.20", remote_port := 16384 }
...
IuUP_Emulation.ttcn:76 dec_IuUP_PDU(): Decoded @IuUP_Types.IuUP_PDU: { type_14 := { pdu_type := 14, ack_nack := IuUP_ACKNACK_CTRL (0), frame_nr := 0, iuup_version := 0, procedure_ind := IuUP_PRI_INITIALIZATION (0), header_crc := 55, payload_crc := 637, u := { proc_sending := { payload := '060051673C0127000082000000000300'O } } } }
...
RTP_Emulation.ttcn:355 Sent on RTP to system @RTP_CodecPort.RTP_Send : { connId := 1, msg := { rtp := { version := 2, padding_ind := '0'B, extension_ind := '0'B, CSRC_count := 0, marker_bit := '0'B, payload_type := 96, sequence_number := 0, time_stamp := '00000000000000000000000000000000'B, SSRC_id := '11011110101011011011111011101111'B, CSRCs := omit, ext_header := omit, data := 'E4002400'O } } }
...
RTP_Emulation.ttcn:355 Message enqueued on RTP from system @Socket_API_Definitions.PortEvent : { result := { errorCode := ERROR_SOCKET (4), connId := 1, os_error_code := 89, os_error_text := "Destination address required" } } id 2

Change-Id: I61200ddb035b310eced871a9954dfcbf1dc49360
This commit is contained in:
Pau Espin 2022-01-07 14:36:25 +01:00
parent a6b9c4ced5
commit 5c50503e87
1 changed files with 6 additions and 2 deletions

View File

@ -448,6 +448,10 @@ function f_main() runs on RTP_Emulation_CT
mtc.stop;
}
g_tx_connected := true;
/* Send any pending IuUP CTRL message whichwas delayed due to not being connected: */
if (isvalue(g_iuup_ent.pending_tx_pdu)) {
f_tx_rtp(''O);
}
CTRL.reply(RTPEM_connect:{g_remote_host, g_remote_port});
}
[] CTRL.getcall(RTPEM_mode:{RTPEM_MODE_NONE}) {
@ -511,7 +515,7 @@ function f_main() runs on RTP_Emulation_CT
if (lengthof(rx_rtp.msg.rtp.data) != 0) {
/* Unexpected RTP payload (user data) arrived: */
g_stats_rtp.num_pkts_rx_err_disabled := g_stats_rtp.num_pkts_rx_err_disabled+1;
} else if (isvalue(g_iuup_ent.pending_tx_pdu)) {
} else if (g_tx_connected and isvalue(g_iuup_ent.pending_tx_pdu)) {
/* IuUP Control packet was received and requires sending back something: */
f_tx_rtp(''O);
}
@ -536,7 +540,7 @@ function f_main() runs on RTP_Emulation_CT
rx_rtp.msg.rtp.data := f_IuUP_Em_rx_decaps(g_iuup_ent, rx_rtp.msg.rtp.data);
/* IuUP Control packet was received which may require sending back something: */
if (lengthof(rx_rtp.msg.rtp.data) == 0) {
if (isvalue(g_iuup_ent.pending_tx_pdu)) {
if (g_tx_connected and isvalue(g_iuup_ent.pending_tx_pdu)) {
f_tx_rtp(''O);
}
repeat;