Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
57e9fbd1
Commit
57e9fbd1
authored
Nov 30, 2017
by
Ghislain MARY
Browse files
Fix once and for all the random port selection in the media session.
parent
88fb7651
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/conference/session/media-session.cpp
src/conference/session/media-session.cpp
+4
-1
No files found.
src/conference/session/media-session.cpp
View file @
57e9fbd1
...
...
@@ -916,8 +916,11 @@ int MediaSessionPrivate::selectRandomPort (int streamIndex, pair<int, int> portR
L_Q
();
for
(
int
nbTries
=
0
;
nbTries
<
100
;
nbTries
++
)
{
bool
alreadyUsed
=
false
;
unsigned
int
rangeSize
=
static_cast
<
unsigned
int
>
(
portRange
.
second
-
portRange
.
first
);
unsigned
int
randomInRangeSize
=
ortp_random
()
%
rangeSize
;
unsigned
int
mask
=
1
;
int
triedPort
=
static_cast
<
int
>
((
ortp_random
()
%
static_cast
<
unsigned
int
>
((
portRange
.
second
-
portRange
.
first
)
+
portRange
.
first
))
&
~
mask
);
unsigned
int
realRandom
=
randomInRangeSize
+
static_cast
<
unsigned
int
>
(
portRange
.
first
);
int
triedPort
=
static_cast
<
int
>
(
realRandom
&
~
mask
);
if
(
triedPort
<
portRange
.
first
)
triedPort
=
portRange
.
first
+
2
;
for
(
const
bctbx_list_t
*
elem
=
linphone_core_get_calls
(
q
->
getCore
()
->
getCCore
());
elem
!=
nullptr
;
elem
=
bctbx_list_next
(
elem
))
{
LinphoneCall
*
lcall
=
reinterpret_cast
<
LinphoneCall
*>
(
bctbx_list_get_data
(
elem
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment