mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-09-20 01:06:15 +02:00
gresolver: Set timeout on default resolver to 30s
The default for the class is still to have no timeout, but it seems more practical for most use cases to set a non-infinite timeout on the default resolver. If applications have a more specific use case, they can change the timeout or replace the default resolver. See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3397#note_1731387 Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
1c4384aec5
commit
e73c5ed5e1
@ -55,6 +55,10 @@
|
||||
* #GNetworkAddress and #GNetworkService provide wrappers around
|
||||
* #GResolver functionality that also implement #GSocketConnectable,
|
||||
* making it easy to connect to a remote host/service.
|
||||
*
|
||||
* The default resolver (see g_resolver_get_default()) has a timeout of 30s set
|
||||
* on it since GLib 2.78. Earlier versions of GLib did not support resolver
|
||||
* timeouts.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
@ -299,7 +303,9 @@ g_resolver_get_default (void)
|
||||
|
||||
G_LOCK (default_resolver);
|
||||
if (!default_resolver)
|
||||
default_resolver = g_object_new (G_TYPE_THREADED_RESOLVER, NULL);
|
||||
default_resolver = g_object_new (G_TYPE_THREADED_RESOLVER,
|
||||
"timeout", 30000,
|
||||
NULL);
|
||||
ret = g_object_ref (default_resolver);
|
||||
G_UNLOCK (default_resolver);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user