Skip to content
Snippets Groups Projects
Commit b1e576a3 authored by Guillaume Roguez's avatar Guillaume Roguez
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
parent 0bc5829b
No related branches found
No related tags found
No related merge requests found
......@@ -545,18 +545,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 {};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment