diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-09-08 13:16:14 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-09-09 11:43:51 +0000 |
commit | 08005d74758784b4bd00ecc87ee155a8977a5007 (patch) | |
tree | 4adcc3114d4a8db617582f0d01c98ad3413e4aec | |
parent | 833174e7fbefd034b440a59b9bc3eda7a386fb84 (diff) |
library/RTP_Emulation: Close previous socket after rebind
If test calls RTPEM_bind twice, the previous socket is kept open
(ConnId 1) while the new one is assigned to the the expected ConnId for
RTP/RTCP packets received (ConnId), however, if remote was already
sending packets, it may happen that the port still receives those with
ConnId=1, which may make test fail with message:
"Received unexpected type from RTP"
Change-Id: I73f4af4e590dd3958e3f4d1dba0496c0750d642d
-rw-r--r-- | library/OSMUX_Emulation.ttcn | 5 | ||||
-rw-r--r-- | library/RTP_Emulation.ttcn | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/library/OSMUX_Emulation.ttcn b/library/OSMUX_Emulation.ttcn index e1275b9e..d31a562b 100644 --- a/library/OSMUX_Emulation.ttcn +++ b/library/OSMUX_Emulation.ttcn @@ -451,6 +451,11 @@ function f_main() runs on OSMUX_Emulation_CT [] CTRL.getcall(OsmuxEM_bind:{?,?}) -> param(g_local_host, g_local_port) { g_tx_connected := false; /* will set it back to true upon next connect() call */ + + if (g_osmux_conn_id != -1) { + res := OSMUX_CodecPort_CtrlFunct.f_IPL4_close(OSMUX, g_osmux_conn_id, {udp := {}}); + g_osmux_conn_id := -1; + } res := OSMUX_CodecPort_CtrlFunct.f_IPL4_listen(OSMUX, g_local_host, g_local_port, {udp:={}}); if (not ispresent(res.connId)) { diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn index 70604dc2..900a196a 100644 --- a/library/RTP_Emulation.ttcn +++ b/library/RTP_Emulation.ttcn @@ -4,7 +4,7 @@ module RTP_Emulation { * * act as a RTP source that generates a RTP Stream * * act asaa RTP sink that consumes a RTP Stream * - * for all of the above, we want to be able to + * for all of the above, we want to be able to * * specify the payload type * * specify the interval / sample rate * * create drop-outs in the stream @@ -387,6 +387,11 @@ function f_main() runs on RTP_Emulation_CT } g_tx_connected := false; /* will set it back to true upon next connect() call */ + + if (g_rtp_conn_id != -1) { + res := RTP_CodecPort_CtrlFunct.f_IPL4_close(RTP, g_rtp_conn_id, {udp := {}}); + g_rtp_conn_id := -1; + } res := RTP_CodecPort_CtrlFunct.f_IPL4_listen(RTP, g_local_host, g_local_port, {udp:={}}); if (not ispresent(res.connId)) { @@ -395,6 +400,11 @@ function f_main() runs on RTP_Emulation_CT } g_rtp_conn_id := res.connId; tr_rtp.connId := g_rtp_conn_id; + + if (g_rtcp_conn_id != -1) { + res := RTP_CodecPort_CtrlFunct.f_IPL4_close(RTCP, g_rtcp_conn_id, {udp := {}}); + g_rtcp_conn_id := -1; + } res := RTP_CodecPort_CtrlFunct.f_IPL4_listen(RTCP, g_local_host, g_local_port+1, {udp:={}}); if (not ispresent(res.connId)) { |