Skip to content

Commit

Permalink
Fix resulting route ID fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Aug 20, 2019
1 parent de2e52d commit 35ba4e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/setup/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ func (sn *Node) createRoute(ctx context.Context, expireAt time.Time, route routi
go func(i int, pk cipher.PubKey, rule routing.Rule, reqIDChIn <-chan routing.RouteID,
reqIDChOut chan<- routing.RouteID) {
routeID, err := sn.setupRule(cancellableCtx, pk, rule, reqIDChIn, reqIDChOut)
// adding rule for initiator must result with a route ID for the overall route
// it doesn't matter for now if there was an error, this result will be fetched only if there wasn't one
if i == 0 {
resultingRouteIDCh <- routeID
}
if err != nil {
// filter out context cancellation errors
if err == context.Canceled {
Expand All @@ -289,11 +294,6 @@ func (sn *Node) createRoute(ctx context.Context, expireAt time.Time, route routi
return
}

// adding rule for initiator must result with a route ID for the overall route
if i == 0 {
resultingRouteIDCh <- routeID
}

rulesSetupErrs <- nil
}(i, r[i].To, rule, reqIDChIn, reqIDChOut)
}
Expand Down

0 comments on commit 35ba4e1

Please sign in to comment.