Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libsoup3
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
GNOME
libsoup3
Commits
4607a5a8
Commit
4607a5a8
authored
2 years ago
by
Carlos Garcia Campos
Browse files
Options
Downloads
Patches
Plain Diff
context-test: use send and read API
This ensure there's no pending IO when the messages are finished.
parent
89c20462
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/context-test.c
+12
-12
12 additions, 12 deletions
tests/context-test.c
with
12 additions
and
12 deletions
tests/context-test.c
+
12
−
12
View file @
4607a5a8
...
...
@@ -130,11 +130,11 @@ message_send_cb (SoupSession *session,
GAsyncResult
*
result
,
GMainContext
*
async_context
)
{
GInputStream
*
stream
;
GBytes
*
body
;
g_assert_true
(
async_context
==
g_main_context_get_thread_default
());
stream
=
soup_session_send_finish
(
session
,
result
,
NULL
);
g_clear_
object
(
&
stream
);
body
=
soup_session_send_
and_read_
finish
(
session
,
result
,
NULL
);
g_clear_
pointer
(
&
body
,
g_bytes_unref
);
}
static
void
...
...
@@ -176,9 +176,9 @@ test1_thread (gpointer user_data)
msg
=
soup_message_new
(
"GET"
,
uri
);
loop
=
g_main_loop_new
(
async_context
,
FALSE
);
g_signal_connect
(
msg
,
"finished"
,
G_CALLBACK
(
message_finished
),
loop
);
soup_session_send_async
(
session
,
msg
,
G_PRIORITY_DEFAULT
,
NULL
,
(
GAsyncReadyCallback
)
message_send_cb
,
async_context
);
soup_session_send_
and_read_
async
(
session
,
msg
,
G_PRIORITY_DEFAULT
,
NULL
,
(
GAsyncReadyCallback
)
message_send_cb
,
async_context
);
g_main_loop_run
(
loop
);
/* We need one more iteration, because SoupMessage::finished is emitted
* right before the message is unqueued.
...
...
@@ -215,7 +215,7 @@ do_test2 (void)
SoupSession
*
session
;
char
*
uri
;
SoupMessage
*
msg
;
GInputStream
*
stream
;
GBytes
*
body
;
GMainLoop
*
loop
;
idle
=
g_idle_add_full
(
G_PRIORITY_HIGH
,
idle_test2_fail
,
NULL
,
NULL
);
...
...
@@ -229,18 +229,18 @@ do_test2 (void)
debug_printf
(
1
,
" send_message
\n
"
);
msg
=
soup_message_new
(
"GET"
,
uri
);
stream
=
soup_session_send
(
session
,
msg
,
NULL
,
NULL
);
body
=
soup_session_send
_and_read
(
session
,
msg
,
NULL
,
NULL
);
soup_test_assert_message_status
(
msg
,
SOUP_STATUS_OK
);
g_
object
_unref
(
stream
);
g_
bytes
_unref
(
body
);
g_object_unref
(
msg
);
debug_printf
(
1
,
" queue_message
\n
"
);
msg
=
soup_message_new
(
"GET"
,
uri
);
loop
=
g_main_loop_new
(
async_context
,
FALSE
);
g_signal_connect
(
msg
,
"finished"
,
G_CALLBACK
(
message_finished
),
loop
);
soup_session_send_async
(
session
,
msg
,
G_PRIORITY_DEFAULT
,
NULL
,
(
GAsyncReadyCallback
)
message_send_cb
,
async_context
);
soup_session_send_
and_read_
async
(
session
,
msg
,
G_PRIORITY_DEFAULT
,
NULL
,
(
GAsyncReadyCallback
)
message_send_cb
,
async_context
);
g_main_loop_run
(
loop
);
/* We need one more iteration, because SoupMessage::finished is emitted
* right before the message is unqueued.
...
...
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