Просмотр исходного кода

Fix resolver "unexpected no IPs" error

Rod Hynes 2 месяцев назад
Родитель
Сommit
3a7af94dbe
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      psiphon/common/resolver/resolver.go

+ 5 - 2
psiphon/common/resolver/resolver.go

@@ -1036,8 +1036,11 @@ func (r *Resolver) ResolveIP(
 	conns.CloseAll()
 	waitGroup.Wait()
 
-	// When there's no answer, return the last error.
-	if result == nil {
+	// When there's no answer, or when there's only an empty IPv6 answer,
+	// return the last error.
+	if result == nil ||
+		(result.questionType == resolverQuestionTypeAAAA && len(result.IPs) == 0) {
+
 		err := lastErr.Load()
 		if err == nil {
 			err = context.Cause(resolveCtx)