Skip to content
Snippets Groups Projects
Commit e59d0f44 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2
Browse files

ice: fix IceTransport getLocalAddress/getRemoteAddress APIs

This patch contains following changes:

* getLocalAddress : wasn't return the negotiated IP if available
* getRemoteAddress : do not check for negotiation state
* some debug added

This fixes bugs during call establishement when IPv6 pair is negotiated,
but an IPv4 TURN is given as candidate (and not selected,
but used as default IP).

Change-Id: I89a973c16674b24cce35dc6dd9433554cb3a41bd
Tuleap: #891
(cherry picked from commit b1e576a3)
parent 15fd0552
Branches
No related tags found
No related merge requests found
...@@ -504,18 +504,33 @@ IceTransport::_isFailed() const ...@@ -504,18 +504,33 @@ IceTransport::_isFailed() const
IpAddr IpAddr
IceTransport::getLocalAddress(unsigned comp_id) const IceTransport::getLocalAddress(unsigned comp_id) const
{ {
// Return the local IP of negotiated connection pair
if (isRunning()) {
if (auto sess = pj_ice_strans_get_valid_pair(icest_.get(), comp_id+1)) {
return sess->lcand->addr;
}
RING_WARN("Non-negotiated transport: try to return default local IP");
}
// Return the default IP (could be not nominated and valid after negotiation)
if (isInitialized()) if (isInitialized())
return cand_[comp_id].addr; return cand_[comp_id].addr;
RING_ERR("bad call: non-initialized transport");
return {}; return {};
} }
IpAddr IpAddr
IceTransport::getRemoteAddress(unsigned comp_id) const IceTransport::getRemoteAddress(unsigned comp_id) const
{ {
if (isInitialized()) { // Return the remote IP of negotiated connection pair
if (isRunning()) {
if (auto sess = pj_ice_strans_get_valid_pair(icest_.get(), comp_id+1)) if (auto sess = pj_ice_strans_get_valid_pair(icest_.get(), comp_id+1))
return sess->rcand->addr; return sess->rcand->addr;
RING_ERR("runtime error: negotiated transport without valid pair");
} }
RING_ERR("bad call: non-negotiated transport");
return {}; return {};
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment