diff options
author | Dan Winship <danw@gnome.org> | 2015-03-02 21:28:18 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2015-03-02 21:28:42 -0500 |
commit | 3401c861f83c0822ab97fe9d169e8dcebd52da23 (patch) | |
tree | 0c44bcb561b11803530ac0f129922d27532aa2f6 /tests/misc-test.c | |
parent | 1c3983f6d0b4097492963f57dd1453f32616c3a3 (diff) | |
download | libsoup-3401c861f83c0822ab97fe9d169e8dcebd52da23.tar.gz |
tests: plug leaks, update libsoup.supp
Diffstat (limited to 'tests/misc-test.c')
-rw-r--r-- | tests/misc-test.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/tests/misc-test.c b/tests/misc-test.c index 4dab6fe8..6d43bd7f 100644 --- a/tests/misc-test.c +++ b/tests/misc-test.c @@ -976,11 +976,10 @@ do_pause_cancel_test (void) g_source_remove (timeout_id); } -static void -steal_after_upgrade (SoupMessage *msg, gpointer user_data) +static gboolean +run_echo_server (gpointer user_data) { - SoupClientContext *context = user_data; - GIOStream *stream; + GIOStream *stream = user_data; GInputStream *istream; GDataInputStream *distream; GOutputStream *ostream; @@ -988,11 +987,6 @@ steal_after_upgrade (SoupMessage *msg, gpointer user_data) gssize n; GError *error = NULL; - /* This should not ever be seen. */ - soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); - - stream = soup_client_context_steal_connection (context); - istream = g_io_stream_get_input_stream (stream); distream = G_DATA_INPUT_STREAM (g_data_input_stream_new (istream)); ostream = g_io_stream_get_output_stream (stream); @@ -1020,6 +1014,26 @@ steal_after_upgrade (SoupMessage *msg, gpointer user_data) g_io_stream_close (stream, NULL, &error); g_assert_no_error (error); g_object_unref (stream); + + return FALSE; +} + +static void +steal_after_upgrade (SoupMessage *msg, gpointer user_data) +{ + SoupClientContext *context = user_data; + GIOStream *stream; + GSource *source; + + /* This should not ever be seen. */ + soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); + + stream = soup_client_context_steal_connection (context); + + source = g_idle_source_new (); + g_source_set_callback (source, run_echo_server, stream, NULL); + g_source_attach (source, g_main_context_get_thread_default ()); + g_source_unref (source); } static void @@ -1196,5 +1210,6 @@ main (int argc, char **argv) soup_test_server_quit_unref (ssl_server); } + test_cleanup (); return ret; } |