diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-16 09:40:32 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-05-26 06:46:33 -0700 |
commit | 432d67b43fe5b8dccb2fc13be63d4ee48ae7b71e (patch) | |
tree | 5bea6c0018a5d8afdfd7c6283323b0406ed1692c /tests/auto/network/kernel | |
parent | 5ecdce0c352d924962f8cd79f2c0bea7f078ddf1 (diff) |
QDnsLookup: add TimeoutError for timeouts
We were getting InvalidReplyError because it was simply unknown, which
is not very useful. Previously, the Unix code used res_nquery(), which
does not return timeouts as a condition. It returns -1 if a timeout did
happen, but the content in errno could be a left-over from a previous
timeout (see the "Not a typewriter"[1] problem).
With the rewrite to using res_nmkquery() and res_nsend() from the
previous commits, we can rely on errno being set properly by
res_nsend().
$ $objdir/tests/manual/qdnslookup/qdnslookup @0.0.0.1
; <<>> QDnsLookup 6.6.0 <<>> qdnslookup @0.0.0.1
;; status: TimeoutError (Request timed out)
;; QUESTION:
;qt-project.org IN A
;; Query time: 10008 ms
;; SERVER: 0.0.0.1#53
Tested on FreeBSD, Linux, macOS, and Windows.
[1] https://en.wikipedia.org/wiki/Not_a_typewriter
Change-Id: I3e3bfef633af4130a03afffd175e31958247f9b1
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/network/kernel')
-rw-r--r-- | tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index 4e2a5397a3..d923a0973f 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -328,7 +328,8 @@ void tst_QDnsLookup::lookup() }; if (!dnsServersMustWork && (lookup.error() == QDnsLookup::ServerFailureError - || lookup.error() == QDnsLookup::ServerRefusedError)) { + || lookup.error() == QDnsLookup::ServerRefusedError + || lookup.error() == QDnsLookup::TimeoutError)) { // It's not a QDnsLookup problem if the server refuses to answer the query. // This happens for queries of type ANY through Dnsmasq, for example. qWarning("Server refused or was unable to answer query; %s", extraErrorMsg().constData()); |