gchar *proxy_password;
gboolean supports_hostname;
GList *next_dest_ip;
+ GError *last_error;
/* Async attributes */
GSimpleAsyncResult *simple;
}
priv->simple = NULL;
+
+ if (priv->last_error)
+ {
+ g_simple_async_result_take_error (simple, priv->last_error);
+ priv->last_error = NULL;
+ }
+
g_simple_async_result_complete (simple);
g_object_unref (simple);
}
g_object_unref);
}
+static void address_enumerate_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data);
+
+static void
+next_proxy (GProxyAddressEnumeratorPrivate *priv)
+{
+ if (*priv->next_proxy)
+ {
+ g_object_unref (priv->addr_enum);
+ priv->addr_enum = NULL;
+
+ if (priv->dest_ips)
+ {
+ g_resolver_free_addresses (priv->dest_ips);
+ priv->dest_ips = NULL;
+ }
+
+ next_enumerator (priv);
+
+ if (priv->addr_enum)
+ {
+ g_socket_address_enumerator_next_async (priv->addr_enum,
+ priv->cancellable,
+ address_enumerate_cb,
+ priv);
+ return;
+ }
+ }
+
+ complete_async (priv);
+}
+
static void
dest_hostname_lookup_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
- GError *error = NULL;
GProxyAddressEnumeratorPrivate *priv = user_data;
- GSimpleAsyncResult *simple = priv->simple;
+ g_clear_error (&priv->last_error);
priv->dest_ips = g_resolver_lookup_by_name_finish (G_RESOLVER (object),
result,
- &error);
+ &priv->last_error);
if (priv->dest_ips)
- save_result (priv);
+ {
+ save_result (priv);
+ complete_async (priv);
+ }
else
- g_simple_async_result_take_error (simple, error);
-
- complete_async (priv);
+ {
+ g_clear_object (&priv->proxy_address);
+ next_proxy (priv);
+ }
}
static void
GAsyncResult *result,
gpointer user_data)
{
- GError *error = NULL;
GProxyAddressEnumeratorPrivate *priv = user_data;
- GSimpleAsyncResult *simple = priv->simple;
+ g_clear_error (&priv->last_error);
priv->proxy_address =
g_socket_address_enumerator_next_finish (priv->addr_enum,
result,
- &error);
+ &priv->last_error);
if (priv->proxy_address)
{
if (!priv->supports_hostname && !priv->dest_ips)
}
save_result (priv);
+ complete_async (priv);
}
- else if (*priv->next_proxy)
- {
- g_object_unref (priv->addr_enum);
- priv->addr_enum = NULL;
-
- if (priv->dest_ips)
- {
- g_resolver_free_addresses (priv->dest_ips);
- priv->dest_ips = NULL;
- }
-
- next_enumerator (priv);
-
- if (priv->addr_enum)
- {
- g_socket_address_enumerator_next_async (priv->addr_enum,
- priv->cancellable,
- address_enumerate_cb,
- priv);
- return;
- }
- }
-
- if (error)
- g_simple_async_result_take_error (simple, error);
-
- complete_async (priv);
+ else
+ next_proxy (priv);
}
static void
if (priv->cancellable)
g_object_unref (priv->cancellable);
+ g_clear_error (&priv->last_error);
+
G_OBJECT_CLASS (g_proxy_address_enumerator_parent_class)->finalize (object);
}