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
0579e478
Commit
0579e478
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
ice_transport: cleanup
Change-Id: I4e10004fa6ff16c8752d788a4d3c4932123ea51f
parent
4268eb2b
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
+9
-7
9 additions, 7 deletions
src/ice_transport.cpp
with
9 additions
and
7 deletions
src/ice_transport.cpp
+
9
−
7
View file @
0579e478
...
@@ -127,9 +127,9 @@ public:
...
@@ -127,9 +127,9 @@ public:
// reflexive candidates using STUN config.
// reflexive candidates using STUN config.
void
addServerReflexiveCandidates
(
const
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>&
addrList
);
void
addServerReflexiveCandidates
(
const
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>&
addrList
);
// Generate server reflexive candidates using the published (DHT/Account) address
// Generate server reflexive candidates using the published (DHT/Account) address
const
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
setupGenericReflexiveCandidates
();
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
setupGenericReflexiveCandidates
();
// Generate server reflexive candidates using UPNP mappings.
// Generate server reflexive candidates using UPNP mappings.
const
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
setupUpnpReflexiveCandidates
();
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
setupUpnpReflexiveCandidates
();
void
setDefaultRemoteAddress
(
unsigned
comp_id
,
const
IpAddr
&
addr
);
void
setDefaultRemoteAddress
(
unsigned
comp_id
,
const
IpAddr
&
addr
);
const
IpAddr
&
getDefaultRemoteAddress
(
unsigned
comp_id
)
const
;
const
IpAddr
&
getDefaultRemoteAddress
(
unsigned
comp_id
)
const
;
bool
handleEvents
(
unsigned
max_msec
);
bool
handleEvents
(
unsigned
max_msec
);
...
@@ -842,8 +842,8 @@ IceTransport::Impl::addServerReflexiveCandidates(
...
@@ -842,8 +842,8 @@ IceTransport::Impl::addServerReflexiveCandidates(
auto
&
stun
=
config_
.
stun_tp
[
config_
.
stun_tp_cnt
-
1
];
auto
&
stun
=
config_
.
stun_tp
[
config_
.
stun_tp_cnt
-
1
];
for
(
unsigned
compIdx
=
0
;
compIdx
<
component_count_
;
compIdx
++
)
{
for
(
unsigned
compIdx
=
0
;
compIdx
<
component_count_
;
compIdx
++
)
{
auto
localAddr
=
addrList
[
compIdx
].
first
;
auto
&
localAddr
=
addrList
[
compIdx
].
first
;
auto
publicAddr
=
addrList
[
compIdx
].
second
;
auto
&
publicAddr
=
addrList
[
compIdx
].
second
;
pj_sockaddr_cp
(
&
stun
.
cfg
.
user_mapping
[
compIdx
].
local_addr
,
localAddr
.
pjPtr
());
pj_sockaddr_cp
(
&
stun
.
cfg
.
user_mapping
[
compIdx
].
local_addr
,
localAddr
.
pjPtr
());
pj_sockaddr_cp
(
&
stun
.
cfg
.
user_mapping
[
compIdx
].
mapped_addr
,
publicAddr
.
pjPtr
());
pj_sockaddr_cp
(
&
stun
.
cfg
.
user_mapping
[
compIdx
].
mapped_addr
,
publicAddr
.
pjPtr
());
...
@@ -863,7 +863,7 @@ IceTransport::Impl::addServerReflexiveCandidates(
...
@@ -863,7 +863,7 @@ IceTransport::Impl::addServerReflexiveCandidates(
assert
(
stun
.
cfg
.
user_mapping_cnt
<
PJ_ICE_MAX_COMP
);
assert
(
stun
.
cfg
.
user_mapping_cnt
<
PJ_ICE_MAX_COMP
);
}
}
const
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
IceTransport
::
Impl
::
setupGenericReflexiveCandidates
()
IceTransport
::
Impl
::
setupGenericReflexiveCandidates
()
{
{
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
addrList
;
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
addrList
;
...
@@ -876,6 +876,7 @@ IceTransport::Impl::setupGenericReflexiveCandidates()
...
@@ -876,6 +876,7 @@ IceTransport::Impl::setupGenericReflexiveCandidates()
// candidates and set to active otherwise.
// candidates and set to active otherwise.
if
(
accountLocalAddr_
and
accountPublicAddr_
)
{
if
(
accountLocalAddr_
and
accountPublicAddr_
)
{
addrList
.
reserve
(
component_count_
);
for
(
unsigned
compIdx
=
0
;
compIdx
<
component_count_
;
compIdx
++
)
{
for
(
unsigned
compIdx
=
0
;
compIdx
<
component_count_
;
compIdx
++
)
{
// For TCP, the type is set to active, because most likely the incoming
// For TCP, the type is set to active, because most likely the incoming
// connection will be blocked by the NAT.
// connection will be blocked by the NAT.
...
@@ -899,7 +900,7 @@ IceTransport::Impl::setupGenericReflexiveCandidates()
...
@@ -899,7 +900,7 @@ IceTransport::Impl::setupGenericReflexiveCandidates()
return
addrList
;
return
addrList
;
}
}
const
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
IceTransport
::
Impl
::
setupUpnpReflexiveCandidates
()
IceTransport
::
Impl
::
setupUpnpReflexiveCandidates
()
{
{
// Add UPNP server reflexive candidates if available.
// Add UPNP server reflexive candidates if available.
...
@@ -919,6 +920,7 @@ IceTransport::Impl::setupUpnpReflexiveCandidates()
...
@@ -919,6 +920,7 @@ IceTransport::Impl::setupUpnpReflexiveCandidates()
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
addrList
;
std
::
vector
<
std
::
pair
<
IpAddr
,
IpAddr
>>
addrList
;
unsigned
compId
=
1
;
unsigned
compId
=
1
;
addrList
.
reserve
(
upnpMappings_
.
size
());
for
(
auto
const
&
[
_
,
map
]
:
upnpMappings_
)
{
for
(
auto
const
&
[
_
,
map
]
:
upnpMappings_
)
{
assert
(
map
.
getMapKey
());
assert
(
map
.
getMapKey
());
IpAddr
localAddr
{
map
.
getInternalAddress
()};
IpAddr
localAddr
{
map
.
getInternalAddress
()};
...
@@ -973,7 +975,7 @@ IceTransport::Impl::onReceiveData(unsigned comp_id, void* pkt, pj_size_t size)
...
@@ -973,7 +975,7 @@ IceTransport::Impl::onReceiveData(unsigned comp_id, void* pkt, pj_size_t size)
io
.
cb
((
uint8_t
*
)
pkt
,
size
);
io
.
cb
((
uint8_t
*
)
pkt
,
size
);
}
else
{
}
else
{
std
::
error_code
ec
;
std
::
error_code
ec
;
auto
err
=
peerChannels_
.
at
(
comp_id
-
1
).
write
((
char
*
)
pkt
,
size
,
ec
);
auto
err
=
peerChannels_
.
at
(
comp_id
-
1
).
write
((
const
char
*
)
pkt
,
size
,
ec
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
JAMI_ERR
(
"[ice:%p] rx: channel is closed"
,
this
);
JAMI_ERR
(
"[ice:%p] rx: channel is closed"
,
this
);
}
}
...
...
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