gresolver: Add GResolver:timeout property

Without a timeout, some lookup requests can go on forever, typically due
to bugs in underlying systems.

This can have particularly significant effects on the Happy Eyeballs
algorithm in `GSocketClient`, which relies on multiple name lookups as
its first step.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2866
This commit is contained in:
Philip Withnall
2023-03-29 17:13:49 +01:00
parent c256af1c2d
commit bf92bae481
3 changed files with 121 additions and 2 deletions

View File

@@ -277,6 +277,11 @@ GList *g_resolver_lookup_records_finish (GResolver
GIO_AVAILABLE_IN_ALL
void g_resolver_free_targets (GList *targets);
GIO_AVAILABLE_IN_2_78
unsigned g_resolver_get_timeout (GResolver *resolver);
GIO_AVAILABLE_IN_2_78
void g_resolver_set_timeout (GResolver *resolver,
unsigned timeout_ms);
/**
* G_RESOLVER_ERROR: