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

Fix error check to work with quic-go v0.31.1

Rod Hynes 3 лет назад
Родитель
Сommit
407c2d05c5
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      psiphon/common/quic/quic.go

+ 4 - 3
psiphon/common/quic/quic.go

@@ -48,6 +48,7 @@ import (
 	"io"
 	"net"
 	"net/http"
+	"strings"
 	"sync"
 	"sync/atomic"
 	"syscall"
@@ -1007,9 +1008,9 @@ func (c *ietfQUICConnection) isErrorIndicatingClosed(err error) bool {
 		return false
 	}
 	errStr := err.Error()
-	// The target errors are of type qerr.ApplicationError and
-	// qerr.IdleTimeoutError, but these are not exported by quic-go.
-	return errStr == "Application error 0x0" ||
+	// The target errors are of type qerr.ApplicationError[Code] and
+	// qerr.IdleTimeoutError, but these are not both exported by quic-go.
+	return strings.HasPrefix(errStr, "Application error 0x0") ||
 		errStr == "timeout: no recent network activity"
 }