- # deal with more nodes
- my $nref = Route::get($call);
- foreach my $ncall (@{$nref->{parent}}) {
- unless ($seen->{$ncall}) {
- dbg("recursing from $call -> $ncall") if isdbg('routec');
- my @rout = findroutes($ncall, $level+1, $seen);
- push @out, @rout;
+ # obtain the dxchannels that have seen this thingy
+ my @parent = $nref->isa('Route::User') ? @{$nref->{parent}} : $call;
+ foreach my $p (@parent) {
+ next if $p eq $main::mycall; # this is dealt with above
+
+ # deal with directly connected nodes, again "best priority"
+ $dxchan = DXChannel::get($p);
+ if ($dxchan) {
+ dbg("ROUTE: findroutes $call -> connected direct via parent $p") if isdbg('findroutes');
+ $cand{$p} = 99;
+ next;
+ }
+
+ my $r = Route::Node::get($p);
+ if ($r) {
+ my %r = $r->PC92C_dxchan;
+ while (my ($k, $v) = each %r) {
+ $cand{$k} = $v if $v > ($cand{$k} || 0);
+ }
+ }
+ }
+
+ # remove any dxchannels that have gone away
+ while (my ($k, $v) = each %cand) {
+ if (my $dxc = DXChannel::get($k)) {
+ push @out, [$v, $dxc];