Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
35c6eab3
Commit
35c6eab3
authored
4 years ago
by
Mohamed Chibani
Committed by
Adrien Béraud
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ice: log the address type of the selected candidate pair
Change-Id: Ie0eec02ad6f1eba6cbd19f198fafc5024e0a6bf7 GitLab:
#290
parent
00330fd8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ice_transport.cpp
+44
-26
44 additions, 26 deletions
src/ice_transport.cpp
with
44 additions
and
26 deletions
src/ice_transport.cpp
+
44
−
26
View file @
35c6eab3
...
...
@@ -113,8 +113,10 @@ public:
bool
_isRunning
()
const
;
bool
_isFailed
()
const
;
const
pj_ice_sess_cand
*
getSelectedCandidate
(
unsigned
comp_id
,
bool
remote
)
const
;
IpAddr
getLocalAddress
(
unsigned
comp_id
)
const
;
IpAddr
getRemoteAddress
(
unsigned
comp_id
)
const
;
static
const
char
*
getCandidateType
(
const
pj_ice_sess_cand
*
cand
);
std
::
unique_ptr
<
pj_pool_t
,
std
::
function
<
void
(
pj_pool_t
*
)
>>
pool_
{};
IceTransportCompleteCb
on_initdone_cb_
{};
...
...
@@ -591,14 +593,18 @@ IceTransport::Impl::onComplete(pj_ice_strans* ice_st, pj_ice_strans_op op, pj_st
for
(
unsigned
i
=
0
;
i
<
component_count_
;
++
i
)
{
auto
laddr
=
getLocalAddress
(
i
);
auto
raddr
=
getRemoteAddress
(
i
);
if
(
laddr
and
raddr
)
{
out
<<
" ["
<<
i
<<
"] "
<<
laddr
.
toString
(
true
,
true
)
<<
" <-> "
<<
raddr
.
toString
(
true
,
true
)
<<
'\n'
;
out
<<
" ["
<<
i
+
1
<<
"] "
<<
laddr
.
toString
(
true
,
true
)
<<
" ["
<<
getCandidateType
(
getSelectedCandidate
(
i
,
false
))
<<
"] "
<<
" <-> "
<<
raddr
.
toString
(
true
,
true
)
<<
" ["
<<
getCandidateType
(
getSelectedCandidate
(
i
,
true
))
<<
"] "
<<
'\n'
;
}
else
{
out
<<
" ["
<<
i
<<
"] disabled
\n
"
;
out
<<
" ["
<<
i
+
1
<<
"] disabled
\n
"
;
}
}
JAMI_DBG
(
"[ice:%p] %s connection pairs (local <-> remote):
\n
%s"
,
JAMI_DBG
(
"[ice:%p] %s connection pairs ([comp id] local [type] <-> remote [type]):
\n
%s"
,
this
,
(
config_
.
protocol
==
PJ_ICE_TP_TCP
?
"TCP"
:
"UDP"
),
out
.
str
().
c_str
());
...
...
@@ -645,42 +651,54 @@ IceTransport::Impl::setSlaveSession()
return
createIceSession
(
PJ_ICE_SESS_ROLE_CONTROLLED
);
}
IpAddr
IceTransport
::
Impl
::
get
LocalAddress
(
unsigned
comp_id
)
const
const
pj_ice_sess_cand
*
IceTransport
::
Impl
::
get
SelectedCandidate
(
unsigned
comp_id
,
bool
remote
)
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
;
// Return the selected candidate pair. Might not be the nominated pair if
// ICE has not concluded yet, but should be the nominated pair afterwards.
if
(
not
_isRunning
())
{
JAMI_ERR
(
"[ice:%p] ICE transport is not running"
,
this
);
return
nullptr
;
}
const
auto
*
sess
=
pj_ice_strans_get_valid_pair
(
icest_
.
get
(),
comp_id
+
1
);
if
(
sess
==
nullptr
)
{
JAMI_ERR
(
"[ice:%p] Component %i has no valid pair"
,
this
,
comp_id
);
return
nullptr
;
}
if
(
remote
)
return
sess
->
rcand
;
else
return
{};
// disabled component
}
else
JAMI_WARN
(
"[ice:%p] bad call: non-negotiated transport"
,
this
);
return
sess
->
lcand
;
}
// Return the default IP (could be not nominated and valid after negotiation)
if
(
_isInitialized
())
return
cand_
[
comp_id
].
addr
;
IpAddr
IceTransport
::
Impl
::
getLocalAddress
(
unsigned
comp_id
)
const
{
if
(
auto
cand
=
getSelectedCandidate
(
comp_id
,
false
))
return
cand
->
addr
;
JAMI_ERR
(
"[ice:%p]
bad call: non-initialized transport"
,
this
);
JAMI_ERR
(
"[ice:%p]
No local address for component %i"
,
this
,
comp_id
);
return
{};
}
IpAddr
IceTransport
::
Impl
::
getRemoteAddress
(
unsigned
comp_id
)
const
{
// 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
;
else
return
{};
// disabled component
}
else
JAMI_WARN
(
"[ice:%p] bad call: non-negotiated transport"
,
this
);
if
(
auto
cand
=
getSelectedCandidate
(
comp_id
,
true
))
return
cand
->
addr
;
JAMI_ERR
(
"[ice:%p]
bad call: non-negotiated transport"
,
this
);
JAMI_ERR
(
"[ice:%p]
No remote address for component %i"
,
this
,
comp_id
);
return
{};
}
const
char
*
IceTransport
::
Impl
::
getCandidateType
(
const
pj_ice_sess_cand
*
cand
)
{
auto
name
=
cand
?
pj_ice_get_cand_type_name
(
cand
->
type
)
:
nullptr
;
return
name
?
name
:
"?"
;
}
void
IceTransport
::
Impl
::
getUFragPwd
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment