Skip to content

Commit

Permalink
Fix panic (receiving of forward intermediary rule caused panic)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Nov 25, 2019
1 parent 5e2d9f8 commit f6da28b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ func (r *router) handleDataPacket(ctx context.Context, packet routing.Packet) er
return err
}

if rule.Type() == routing.RuleIntermediaryForward {
return r.forwardPacket(ctx, packet.Payload(), rule)
}

desc := rule.RouteDescriptor()
rg, ok := r.routeGroup(desc)
if !ok {
Expand All @@ -318,7 +322,8 @@ func (r *router) handleDataPacket(ctx context.Context, packet routing.Packet) er

r.logger.Infof("Got new remote packet with route ID %d. Using rule: %s", packet.RouteID(), rule)

if t := rule.Type(); t == routing.RuleForward || t == routing.RuleIntermediaryForward {
// TODO: maybe move this up along the execution flow? `rg` doesn't seem to be necessary here
if t := rule.Type(); t == routing.RuleForward {
return r.forwardPacket(ctx, packet.Payload(), rule)
}

Expand Down

0 comments on commit f6da28b

Please sign in to comment.