fix Route::findroutes?
[spider.git] / perl / Route.pm
index d4fb95d4205eae5143959c9c6efd130b0da1eb43..860c5235176449a59a8842b798785a16d8c47ae4 100644 (file)
@@ -301,13 +301,16 @@ sub findroutes
                push @out, $level ? [$level, $dxchan] : $dxchan;
                return @out;
        }
+       $seen->{$call}++;
 
        # deal with more nodes
        my $nref = Route::get($call);
        foreach my $ncall (@{$nref->{parent}}) {
-               dbg("recursing from $call -> $ncall") if isdbg('routec');
-               my @rout = findroutes($ncall, $level+1, $seen);
-               push @out, @rout;
+               unless ($seen->{$ncall}) {
+                       dbg("recursing from $call -> $ncall") if isdbg('routec');
+                       my @rout = findroutes($ncall, $level+1, $seen);
+                       push @out, @rout;
+               }
        }
 
        return $level == 0 ? map {$_->[1]} sort {$a->[0] <=> $b->[0]} @out : @out;