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
95c2ecc6
Commit
95c2ecc6
authored
Mar 27, 2014
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test-fullmode: Don't use gmainloop when not required
There are more than one callback that could stop it
parent
80be0d93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
tests/test-fullmode.c
tests/test-fullmode.c
+21
-8
No files found.
tests/test-fullmode.c
View file @
95c2ecc6
...
...
@@ -155,10 +155,15 @@ static gboolean timer_cb (gpointer pointer)
return
FALSE
;
}
static
void
cb_writable
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
)
static
void
cb_writable
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
gpointer
user_data
)
{
guint
*
ls_id
=
user_data
;
if
(
stream_id
==
*
ls_id
&&
component_id
==
1
)
{
g_debug
(
"Transport is now writable, stopping mainloop"
);
g_main_loop_quit
(
global_mainloop
);
*
ls_id
=
0
;
}
}
static
void
cb_nice_recv
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
guint
len
,
gchar
*
buf
,
gpointer
user_data
)
...
...
@@ -469,10 +474,13 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_debug
(
"Sending data returned -1 in %s mode"
,
reliable
?
"Reliable"
:
"Non-reliable"
);
if
(
reliable
)
{
gulong
signal_handler
;
guint
ls_id_copy
=
ls_id
;
signal_handler
=
g_signal_connect
(
G_OBJECT
(
lagent
),
"reliable-transport-writable"
,
G_CALLBACK
(
cb_writable
),
NULL
);
"reliable-transport-writable"
,
G_CALLBACK
(
cb_writable
),
&
ls_id_copy
);
g_debug
(
"Running mainloop until transport is writable"
);
g_main_loop_run
(
global_mainloop
);
while
(
ls_id_copy
==
ls_id
)
g_main_context_iteration
(
NULL
,
TRUE
);
g_signal_handler_disconnect
(
G_OBJECT
(
lagent
),
signal_handler
);
ret
=
nice_agent_send
(
lagent
,
ls_id
,
1
,
16
,
"1234567812345678"
);
...
...
@@ -480,7 +488,8 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
}
g_debug
(
"Sent %d bytes"
,
ret
);
g_assert
(
ret
==
16
);
g_main_loop_run
(
global_mainloop
);
while
(
global_ragent_read
!=
16
)
g_main_context_iteration
(
NULL
,
TRUE
);
g_assert
(
global_ragent_read
==
16
);
g_debug
(
"test-fullmode: Ran mainloop, removing streams..."
);
...
...
@@ -592,14 +601,18 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
/* note: test payload send and receive */
global_ragent_read
=
0
;
ret
=
nice_agent_send
(
lagent
,
ls_id
,
1
,
16
,
"1234567812345678"
);
{
if
(
ret
==
-
1
)
{
gboolean
reliable
=
FALSE
;
g_object_get
(
G_OBJECT
(
lagent
),
"reliable"
,
&
reliable
,
NULL
);
if
(
reliable
)
{
gulong
signal_handler
;
guint
ls_id_copy
=
ls_id
;
signal_handler
=
g_signal_connect
(
G_OBJECT
(
lagent
),
"reliable-transport-writable"
,
G_CALLBACK
(
cb_writable
),
NULL
);
g_main_loop_run
(
global_mainloop
);
"reliable-transport-writable"
,
G_CALLBACK
(
cb_writable
),
&
ls_id_copy
);
g_debug
(
"Running mainloop until transport is writable"
);
while
(
ls_id_copy
==
ls_id
)
g_main_context_iteration
(
NULL
,
TRUE
);
g_signal_handler_disconnect
(
G_OBJECT
(
lagent
),
signal_handler
);
ret
=
nice_agent_send
(
lagent
,
ls_id
,
1
,
16
,
"1234567812345678"
);
...
...
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