Ver código fonte

lib/connections: Use proper errors.Is check (#9538)

WangXi 1 ano atrás
pai
commit
f2d6722348
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      lib/connections/quic_listen.go

+ 2 - 1
lib/connections/quic_listen.go

@@ -12,6 +12,7 @@ package connections
 import (
 	"context"
 	"crypto/tls"
+	"errors"
 	"net"
 	"net/url"
 	"sync"
@@ -145,7 +146,7 @@ func (t *quicListener) serve(ctx context.Context) error {
 		}
 
 		session, err := listener.Accept(ctx)
-		if err == context.Canceled {
+		if errors.Is(err, context.Canceled) {
 			return nil
 		} else if err != nil {
 			l.Infoln("Listen (BEP/quic): Accepting connection:", err)