Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
02d53363
Commit
02d53363
authored
Jan 28, 2019
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test-drop-invalid: Fix raciness
parent
68808e66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
9 deletions
+38
-9
tests/test-drop-invalid.c
tests/test-drop-invalid.c
+38
-9
No files found.
tests/test-drop-invalid.c
View file @
02d53363
...
@@ -257,10 +257,33 @@ static void set_credentials (NiceAgent *lagent, guint lstream,
...
@@ -257,10 +257,33 @@ static void set_credentials (NiceAgent *lagent, guint lstream,
g_free
(
password
);
g_free
(
password
);
}
}
static
guint16
get_port
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
)
{
GSList
*
cands
=
nice_agent_get_local_candidates
(
agent
,
stream_id
,
component_id
);
GSList
*
item
;
guint16
port
=
0
;
g_assert
(
cands
!=
NULL
);
for
(
item
=
cands
;
item
;
item
=
item
->
next
)
{
NiceCandidate
*
cand
=
item
->
data
;
port
=
nice_address_get_port
(
&
cand
->
addr
);
break
;
}
g_assert
(
port
!=
0
);
g_slist_free_full
(
cands
,
(
GDestroyNotify
)
nice_candidate_free
);
return
port
;
}
static
int
run_full_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
,
guint
ready
,
guint
failed
)
static
int
run_full_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
,
guint
ready
,
guint
failed
)
{
{
guint
ls_id
,
rs_id
;
guint
ls_id
,
rs_id
;
gint
ret
;
gint
ret
;
guint16
port
;
/* XXX: dear compiler, this is for you */
/* XXX: dear compiler, this is for you */
(
void
)
baseaddr
;
(
void
)
baseaddr
;
...
@@ -288,15 +311,17 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
...
@@ -288,15 +311,17 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
rs_id
>
0
);
g_assert
(
rs_id
>
0
);
/* Gather candidates and test nice_agent_set_port_range */
/* Gather candidates and test nice_agent_set_port_range */
nice_agent_set_port_range
(
lagent
,
ls_id
,
1
,
10000
,
10000
);
nice_agent_set_port_range
(
lagent
,
ls_id
,
1
,
10000
,
11000
);
nice_agent_set_port_range
(
lagent
,
ls_id
,
2
,
10001
,
10001
);
nice_agent_set_port_range
(
lagent
,
ls_id
,
2
,
11000
,
12000
);
nice_agent_set_port_range
(
ragent
,
rs_id
,
1
,
12345
,
12345
);
nice_agent_set_port_range
(
ragent
,
rs_id
,
2
,
10000
,
10001
);
g_assert
(
nice_agent_gather_candidates
(
lagent
,
ls_id
)
==
TRUE
);
g_assert
(
nice_agent_gather_candidates
(
lagent
,
ls_id
)
==
TRUE
);
port
=
get_port
(
lagent
,
ls_id
,
1
);
nice_agent_set_port_range
(
ragent
,
rs_id
,
1
,
12000
,
13000
);
nice_agent_set_port_range
(
ragent
,
rs_id
,
2
,
port
,
port
);
g_assert
(
nice_agent_gather_candidates
(
ragent
,
rs_id
)
==
FALSE
);
g_assert
(
nice_agent_gather_candidates
(
ragent
,
rs_id
)
==
FALSE
);
g_assert
(
nice_agent_get_local_candidates
(
ragent
,
rs_id
,
1
)
==
NULL
);
g_assert
(
nice_agent_get_local_candidates
(
ragent
,
rs_id
,
1
)
==
NULL
);
g_assert
(
nice_agent_get_local_candidates
(
ragent
,
rs_id
,
2
)
==
NULL
);
g_assert
(
nice_agent_get_local_candidates
(
ragent
,
rs_id
,
2
)
==
NULL
);
nice_agent_set_port_range
(
ragent
,
rs_id
,
2
,
1
0000
,
10002
);
nice_agent_set_port_range
(
ragent
,
rs_id
,
2
,
1
3000
,
14000
);
g_assert
(
nice_agent_gather_candidates
(
ragent
,
rs_id
)
==
TRUE
);
g_assert
(
nice_agent_gather_candidates
(
ragent
,
rs_id
)
==
TRUE
);
{
{
...
@@ -307,7 +332,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
...
@@ -307,7 +332,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
g_slist_length
(
cands
)
==
1
);
g_assert
(
g_slist_length
(
cands
)
==
1
);
cand
=
cands
->
data
;
cand
=
cands
->
data
;
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
==
10000
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
>=
10000
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
<=
11000
);
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
g_slist_free
(
cands
);
g_slist_free
(
cands
);
...
@@ -316,7 +342,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
...
@@ -316,7 +342,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
g_slist_length
(
cands
)
==
1
);
g_assert
(
g_slist_length
(
cands
)
==
1
);
cand
=
cands
->
data
;
cand
=
cands
->
data
;
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
==
10001
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
>=
11000
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
<=
12000
);
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
g_slist_free
(
cands
);
g_slist_free
(
cands
);
...
@@ -325,7 +352,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
...
@@ -325,7 +352,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
g_slist_length
(
cands
)
==
1
);
g_assert
(
g_slist_length
(
cands
)
==
1
);
cand
=
cands
->
data
;
cand
=
cands
->
data
;
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
==
12345
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
>=
12000
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
<=
13000
);
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
g_slist_free
(
cands
);
g_slist_free
(
cands
);
...
@@ -334,7 +362,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
...
@@ -334,7 +362,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
g_slist_length
(
cands
)
==
1
);
g_assert
(
g_slist_length
(
cands
)
==
1
);
cand
=
cands
->
data
;
cand
=
cands
->
data
;
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
cand
->
type
==
NICE_CANDIDATE_TYPE_HOST
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
==
10002
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
>=
13000
);
g_assert
(
nice_address_get_port
(
&
cand
->
addr
)
<=
14000
);
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
for
(
i
=
cands
;
i
;
i
=
i
->
next
)
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
nice_candidate_free
((
NiceCandidate
*
)
i
->
data
);
g_slist_free
(
cands
);
g_slist_free
(
cands
);
...
...
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