[MERGED] libosmo-abis[master]: osmo_ortp.c: fix order of set_connected_mode and set_remote_...

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 5 14:18:02 UTC 2016


Neels Hofmeyr has submitted this change and it was merged.

Change subject: osmo_ortp.c: fix order of set_connected_mode and set_remote_addr
......................................................................


osmo_ortp.c: fix order of set_connected_mode and set_remote_addr

In libortp, rtp_session_set_connected_mode() sets a flag that is used in
rtp_session_set_remote_addr().

The name rtp_session_set_remote_addr() is misleading: this function actually
does take a lot of action, including an attempt to connect to the remote
server. Thus the "connected mode" flag needs to be set before this.

Suggested-by: NuRan Wireless <nuranwireless.com>
Change-Id: I92308ddffc376af8d4d65e6b9cbeee222b7bff5e
---
M src/trau/osmo_ortp.c
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index eb78212..cdcc1e7 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -392,16 +392,18 @@
 		return 0;
 	}
 
-	rc = rtp_session_set_remote_addr(rs->sess, ip, port);
-	if (rc < 0)
-		return rc;
-
 	/* enable the use of connect() so later getsockname() will
 	 * actually return the IP address that was chosen for the local
 	 * sid of the connection */
 	rtp_session_set_connected_mode(rs->sess, 1);
 	rs->flags &= ~OSMO_RTP_F_DISABLED;
 
+	/* This call attempts to connect to the remote address, so make sure to
+	 * set all other rtp session configuration before this call. */
+	rc = rtp_session_set_remote_addr(rs->sess, ip, port);
+	if (rc < 0)
+		return rc;
+
 	if (rs->flags & OSMO_RTP_F_POLL)
 		return rc;
 	else

-- 
To view, visit https://gerrit.osmocom.org/815
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I92308ddffc376af8d4d65e6b9cbeee222b7bff5e
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list