[MERGED] libosmo-abis[master]: Really fix order of set_connected_mode and set_remote_addr

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
Thu Oct 6 23:56:31 UTC 2016


Neels Hofmeyr has submitted this change and it was merged.

Change subject: Really fix order of set_connected_mode and set_remote_addr
......................................................................


Really fix order of set_connected_mode and set_remote_addr

This reverts commit c77c2a6aa13accbc558888ab788d1148eb9aeb1a,
and explicitly sets connected mode to zero for set_remote_addr to work around
internal libortp problems. See https://osmocom.org/issues/1661#note-15.

Related: OS#1661
Change-Id: I9d146c3bd76e02685b09278167b56029152221a0
---
M src/trau/osmo_ortp.c
1 file changed, 12 insertions(+), 6 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/trau/osmo_ortp.c b/src/trau/osmo_ortp.c
index 5441337..6ce70d2 100644
--- a/src/trau/osmo_ortp.c
+++ b/src/trau/osmo_ortp.c
@@ -389,17 +389,23 @@
 		return 0;
 	}
 
+	/* We don't want the connected mode enabled during
+	 * rtp_session_set_remote_addr(), because that will already setup a
+	 * connection and updating the remote address will no longer have an
+	 * effect. Contrary to what one may expect, this must be 0 at first,
+	 * and we're setting to 1 further down to establish a connection once
+	 * the first RTP packet is received (OS#1661). */
+	rtp_session_set_connected_mode(rs->sess, 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;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9d146c3bd76e02685b09278167b56029152221a0
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list