From 788f1309415fbd819656f1355f11f1a8dd53919c Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Mon, 22 Jul 2024 15:49:25 +0200 Subject: [PATCH] Retry management connection only on context canceled (#2301) --- management/client/grpc.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/management/client/grpc.go b/management/client/grpc.go index 568c15313..eaadcd317 100644 --- a/management/client/grpc.go +++ b/management/client/grpc.go @@ -334,8 +334,11 @@ func (c *GrpcClient) login(serverKey wgtypes.Key, req *proto.LoginRequest) (*pro Body: loginReq, }) if err != nil { - log.Printf("Login error: %v", err) - return err + // retry only on context canceled + if s, ok := gstatus.FromError(err); ok && s.Code() == codes.Canceled { + return err + } + return backoff.Permanent(err) } return nil