aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-06 15:43:38 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-06 15:50:18 +0200
commita0ff942e927e771875a183c045b3a1676a7d579c (patch)
treedeacc474b26ea4002ba8f88840ffa1c9b9708f54
parent24796f21475248f07884da8e22c2c9178f030a5d (diff)
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
-rw-r--r--src/trau/osmo_ortp.c18
1 files changed, 12 insertions, 6 deletions
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,18 +389,24 @@ int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t
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;
else