Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
gio/tests/proxy-test: fix cleanup
Browse files Browse the repository at this point in the history
make sure the proxy threads are in the "waiting for a connection"
state when we do the final cleanup, or else there are race conditions
involving which thread processes the GCancellable cancellation first.
  • Loading branch information
danwinship committed Jun 21, 2012
1 parent e9ec1ad commit e0f4b2b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gio/tests/proxy-test.c
Expand Up @@ -1064,21 +1064,25 @@ test_dns (gpointer fixture,
uri = g_strdup_printf ("beta://no-such-host.xx:%u", server.server_port);
conn = g_socket_client_connect_to_uri (client, uri, 0, NULL, &error);
g_assert_no_error (error);
g_clear_object (&conn);

g_assert_no_error (proxy_a.last_error);
g_assert_no_error (proxy_b.last_error);

do_echo_test (conn);
g_clear_object (&conn);
teardown_test (NULL, NULL);

g_socket_client_connect_to_uri_async (client, uri, 0, NULL,
async_got_conn, &conn);
while (conn == NULL)
g_main_context_iteration (NULL, TRUE);
g_clear_object (&conn);
g_free (uri);

g_assert_no_error (proxy_a.last_error);
g_assert_no_error (proxy_b.last_error);

do_echo_test (conn);
g_clear_object (&conn);
teardown_test (NULL, NULL);
}

Expand Down

0 comments on commit e0f4b2b

Please sign in to comment.