fix(dns): 在查询前终止非正超时

This commit is contained in:
tsosunchia committed 2026-07-27 17:55:38 +08:00
1 parent 26308c6101
commit 7a2f2bcdb2
1 file changed
+6
+6
View File
@@ -189,6 +189,12 @@ func runTimedDNSWork(
cleanup func(),
work func(context.Context) error,
) error {
if totalTimeout <= 0 {
stdout.disable()
stderr.disable()
cleanup()
return normalizeRunError(context.DeadlineExceeded, totalTimeout)
}
baseCtx, cancel := context.WithCancel(parent)
defer cancel()
extensions := make(chan time.Duration)