Skip to content

Commit

Permalink
fix linter issue
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik committed Feb 22, 2022
1 parent 23c70b9 commit 335f71c
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions pkg/networkservice/common/discoverforwarder/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,23 @@ func (d *discoverForwarderServer) Request(ctx context.Context, request *networks
}

for _, candidate := range nses {
if candidate.Name == datapathForwarder {
u, err := url.Parse(candidate.Url)

if err != nil {
logger.Errorf("can not parse forwarder=%v url=%v error=%v", nses[0].Name, u, err.Error())
return nil, errors.WithStack(err)
}

conn, err := next.Server(ctx).Request(clienturlctx.WithClientURL(ctx, u), request)
if err != nil {
continue
}
storeForwarderName(ctx, candidate.Name)
if candidate.Name != datapathForwarder {
continue
}

u, err := url.Parse(candidate.Url)

if err != nil {
logger.Errorf("can not parse forwarder=%v url=%v error=%v", candidate.Name, u, err.Error())
return nil, errors.WithStack(err)
}

return conn, err
resp, err := next.Server(ctx).Request(clienturlctx.WithClientURL(ctx, u), request)
if err == nil {
storeForwarderName(ctx, candidate.Name)
return resp, nil
}
return nil, err
}

if len(nses) == 0 {
Expand Down

0 comments on commit 335f71c

Please sign in to comment.