Change in osmo-ttcn3-hacks[master]: library/RTP_Emulation: Close previous socket after rebind

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Sep 8 16:21:07 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20032 )


Change subject: library/RTP_Emulation: Close previous socket after rebind
......................................................................

library/RTP_Emulation: Close previous socket after rebind

If test calls RTPEM_bind twice, the previosu 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
---
M library/OSMUX_Emulation.ttcn
M library/RTP_Emulation.ttcn
2 files changed, 16 insertions(+), 1 deletion(-)



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

diff --git a/library/OSMUX_Emulation.ttcn b/library/OSMUX_Emulation.ttcn
index e1275b9..d31a562 100644
--- a/library/OSMUX_Emulation.ttcn
+++ b/library/OSMUX_Emulation.ttcn
@@ -451,6 +451,11 @@
 		[] 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 70604dc..900a196 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -4,7 +4,7 @@
  *  * 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 @@
 			}
 
 			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 @@
 			}
 			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)) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20032
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: I73f4af4e590dd3958e3f4d1dba0496c0750d642d
Gerrit-Change-Number: 20032
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200908/82285efc/attachment.htm>


More information about the gerrit-log mailing list