Skip to content

Commit

Permalink
apply suggestions
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 24, 2022
1 parent 0fc5ace commit d129d85
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions pkg/networkservice/common/discoverforwarder/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,11 @@ func (d *discoverForwarderServer) Request(ctx context.Context, request *networks
datapathForwarder = segments[pathIndex+1].Name
}

for _, candidate := range nses {
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)
}

resp, err := next.Server(ctx).Request(clienturlctx.WithClientURL(ctx, u), request)
if err != nil {
continue
for i, candidate := range nses {
if candidate.Name == datapathForwarder {
nses[0], nses[i] = nses[i], nses[0]
break
}
storeForwarderName(ctx, candidate.Name)
return resp, nil
}

var candidatesErr = errors.New("all forwarders have failed")
Expand Down

0 comments on commit d129d85

Please sign in to comment.