Commit c90f5194 authored by Jussi Kukkonen's avatar Jussi Kukkonen Committed by Jens Georg
Browse files

tests: Add a way to test cancelling introspection gets

First ctrl-C in test-introspection will cancel all current and future
gupnp_service_info_get_introspection_async_full() calls.

https://bugzilla.gnome.org/show_bug.cgi?id=704867
parent 909e721c
......@@ -30,6 +30,8 @@
GMainLoop *main_loop;
static GCancellable *cancellable;
static gboolean async = FALSE;
static GOptionEntry entries[] =
{
......@@ -41,7 +43,13 @@ static GOptionEntry entries[] =
static void
interrupt_signal_handler (G_GNUC_UNUSED int signum)
{
g_main_loop_quit (main_loop);
if (g_cancellable_is_cancelled (cancellable)) {
g_main_loop_quit (main_loop);
} else {
g_print ("Canceling all introspection calls. "
"Press ^C again to quit.\n");
g_cancellable_cancel (cancellable);
}
}
static void
......@@ -202,9 +210,10 @@ service_proxy_available_cb (G_GNUC_UNUSED GUPnPControlPoint *cp,
info = GUPNP_SERVICE_INFO (proxy);
if (async) {
gupnp_service_info_get_introspection_async (info,
got_introspection,
NULL);
gupnp_service_info_get_introspection_async_full (info,
got_introspection,
cancellable,
NULL);
} else {
introspection =
gupnp_service_info_get_introspection (info, &error);
......@@ -270,6 +279,8 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
cancellable = g_cancellable_new ();
/* We're interested in everything */
cp = gupnp_control_point_new (context, "ssdp:all");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment