Retry management connection only on context canceled (#2301)

This commit is contained in:
Maycon Santos 2024-07-22 15:49:25 +02:00 committed by GitHub
parent 926e11b086
commit 788f130941
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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