diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-05 14:09:56 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-05 14:18:08 +0200 |
commit | c77c2a6aa13accbc558888ab788d1148eb9aeb1a (patch) | |
tree | c8c212860eeb211f60fb1e149bf7b41d8b289907 /src/trau/osmo_ortp.c | |
parent | 085ab0bb9ce99693e8b06acf721cf415abc08cf0 (diff) |
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
Diffstat (limited to 'src/trau/osmo_ortp.c')
-rw-r--r-- | src/trau/osmo_ortp.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 @@ int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t 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 |