feat(webconnectivity@v0.5): record late DNS replies (#883)

Part of https://github.com/ooni/probe/issues/2237
This commit is contained in:
Simone Basso 2022-08-26 18:32:36 +02:00 committed by GitHub
commit c3964e43b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View file

@ -249,6 +249,21 @@ func (t *DNSResolvers) lookupHostUDP(parentCtx context.Context, udpAddress strin
ol.Stop(err)
out <- addrs
// wait for late DNS replies
t.WaitGroup.Add(1)
go t.waitForLateReplies(parentCtx, trace)
}
// Waits for late DNS replies.
func (t *DNSResolvers) waitForLateReplies(parentCtx context.Context, trace *measurexlite.Trace) {
defer t.WaitGroup.Done()
const lateTimeout = 500 * time.Millisecond
events := trace.DelayedDNSResponseWithTimeout(parentCtx, lateTimeout)
if length := len(events); length > 0 {
t.Logger.Warnf("got %d late DNS replies", length)
}
t.TestKeys.AppendDNSLateReplies(events...)
}
// Divides queries generated by Do53 in Do53-proper queries and other queries.