* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
/**
* g_socket_client_set_local_address:
* @client: a #GSocketClient.
- * @address: (allow-none): a #GSocketAddress, or %NULL
+ * @address: (nullable): a #GSocketAddress, or %NULL
*
* Sets the local address of the socket client.
* The sockets created by this object will bound to the
/**
* g_socket_client_set_proxy_resolver:
* @client: a #GSocketClient.
- * @proxy_resolver: (allow-none): a #GProxyResolver, or %NULL for the
+ * @proxy_resolver: (nullable): a #GProxyResolver, or %NULL for the
* default.
*
* Overrides the #GProxyResolver used by @client. You can call this if
* @client: the #GSocketClient
* @event: the event that is occurring
* @connectable: the #GSocketConnectable that @event is occurring on
- * @connection: the current representation of the connection
+ * @connection: (nullable): the current representation of the connection
*
* Emitted when @client's activity on @connectable changes state.
* Among other things, this can be used to provide progress
* g_socket_client_connect:
* @client: a #GSocketClient.
* @connectable: a #GSocketConnectable specifying the remote address.
- * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore.
+ * @cancellable: (nullable): optional #GCancellable object, %NULL to ignore.
* @error: #GError for error reporting, or %NULL to ignore.
*
* Tries to resolve the @connectable and make a network connection to it.
GProxy *proxy;
protocol = g_proxy_address_get_protocol (proxy_addr);
- proxy = g_proxy_get_default_for_protocol (protocol);
/* The connection should not be anything else then TCP Connection,
* but let's put a safety guard in case
g_object_unref (connection);
connection = NULL;
}
- else if (proxy)
+ else if (g_hash_table_contains (client->priv->app_proxies, protocol))
+ {
+ application_proxy = TRUE;
+ }
+ else if ((proxy = g_proxy_get_default_for_protocol (protocol)))
{
GIOStream *proxy_connection;
if (connection)
g_socket_client_emit_event (client, G_SOCKET_CLIENT_PROXY_NEGOTIATED, connectable, connection);
}
- else if (!g_hash_table_lookup_extended (client->priv->app_proxies,
- protocol, NULL, NULL))
+ else
{
g_set_error (&last_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- _("Proxy protocol '%s' is not supported."),
+ _("Proxy protocol ā%sā is not supported."),
protocol);
g_object_unref (connection);
connection = NULL;
}
- else
- {
- application_proxy = TRUE;
- }
}
if (!application_proxy && connection && client->priv->tls)
* @client: a #GSocketClient
* @host_and_port: the name and optionally port of the host to connect to
* @default_port: the default port to connect to
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @error: a pointer to a #GError, or %NULL
*
* This is a helper function for g_socket_client_connect().
* @client: a #GSocketConnection
* @domain: a domain name
* @service: the name of the service to connect to
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @error: a pointer to a #GError, or %NULL
*
* Attempts to create a TCP connection to a service.
* @client: a #GSocketClient
* @uri: A network URI
* @default_port: the default port to connect to
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @error: a pointer to a #GError, or %NULL
*
* This is a helper function for g_socket_client_connect().
}
protocol = g_proxy_address_get_protocol (data->proxy_addr);
- proxy = g_proxy_get_default_for_protocol (protocol);
/* The connection should not be anything other than TCP,
* but let's put a safety guard in case
enumerator_next_async (data);
}
- else if (proxy)
+ else if (g_hash_table_contains (data->client->priv->app_proxies, protocol))
+ {
+ /* Simply complete the connection, we don't want to do TLS handshake
+ * as the application proxy handling may need proxy handshake first */
+ g_socket_client_async_connect_complete (data);
+ }
+ else if ((proxy = g_proxy_get_default_for_protocol (protocol)))
{
g_socket_client_emit_event (data->client, G_SOCKET_CLIENT_PROXY_NEGOTIATING, data->connectable, data->connection);
g_proxy_connect_async (proxy,
data);
g_object_unref (proxy);
}
- else if (!g_hash_table_lookup_extended (data->client->priv->app_proxies,
- protocol, NULL, NULL))
+ else
{
g_clear_error (&data->last_error);
g_set_error (&data->last_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
- _("Proxy protocol '%s' is not supported."),
+ _("Proxy protocol ā%sā is not supported."),
protocol);
enumerator_next_async (data);
}
- else
- {
- /* Simply complete the connection, we don't want to do TLS handshake
- * as the application proxy handling may need proxy handshake first */
- g_socket_client_async_connect_complete (data);
- }
}
static void
* g_socket_client_connect_async:
* @client: a #GSocketClient
* @connectable: a #GSocketConnectable specifying the remote address.
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @callback: (scope async): a #GAsyncReadyCallback
* @user_data: (closure): user data for the callback
*
data->enumerator = g_socket_connectable_enumerate (connectable);
data->task = g_task_new (client, cancellable, callback, user_data);
+ g_task_set_source_tag (data->task, g_socket_client_connect_async);
g_task_set_task_data (data->task, data, (GDestroyNotify)g_socket_client_async_connect_data_free);
enumerator_next_async (data);
* @client: a #GSocketClient
* @host_and_port: the name and optionally the port of the host to connect to
* @default_port: the default port to connect to
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @callback: (scope async): a #GAsyncReadyCallback
* @user_data: (closure): user data for the callback
*
* @client: a #GSocketClient
* @domain: a domain name
* @service: the name of the service to connect to
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @callback: (scope async): a #GAsyncReadyCallback
* @user_data: (closure): user data for the callback
*
* @client: a #GSocketClient
* @uri: a network uri
* @default_port: the default port to connect to
- * @cancellable: (allow-none): a #GCancellable, or %NULL
+ * @cancellable: (nullable): a #GCancellable, or %NULL
* @callback: (scope async): a #GAsyncReadyCallback
* @user_data: (closure): user data for the callback
*
g_socket_client_add_application_proxy (GSocketClient *client,
const gchar *protocol)
{
- g_hash_table_insert (client->priv->app_proxies, g_strdup (protocol), NULL);
+ g_hash_table_add (client->priv->app_proxies, g_strdup (protocol));
}