feat(webconnectivity@v0.5): record late DNS replies (#883)
Part of https://github.com/ooni/probe/issues/2237
This commit is contained in:
parent
1a1d3126ae
commit
c3964e43b3
3 changed files with 27 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue