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
......@@ -504,18 +504,33 @@ IceTransport::_isFailed() const
IpAddr
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())
return cand_[comp_id].addr;
RING_ERR("bad call: non-initialized transport");
return {};
}
IpAddr
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))
return sess->rcand->addr;
RING_ERR("runtime error: negotiated transport without valid pair");
}
RING_ERR("bad call: non-negotiated transport");
return {};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment