X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute.pm;h=72bb5db44b8afb42b7c3319dabfd41ab21b9430d;hb=05bed9a172a48255aff58f64ab01df58a4d87891;hp=860c5235176449a59a8842b798785a16d8c47ae4;hpb=7bb8e1e37a19c197b2bc1f47a6ee07bccb368b74;p=spider.git diff --git a/perl/Route.pm b/perl/Route.pm index 860c5235..72bb5db4 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -320,30 +320,7 @@ sub findroutes sub alldxchan { my $self = shift; - my @dxchan; -# dbg("Trying node $self->{call}") if isdbg('routech'); - - my $dxchan = DXChannel::get($self->{call}); - push @dxchan, $dxchan if $dxchan; - - # it isn't, build up a list of dxchannels and possible ping times - # for all the candidates. - unless (@dxchan) { - foreach my $p (@{$self->{parent}}) { -# dbg("Trying parent $p") if isdbg('routech'); - next if $p eq $main::mycall; # the root - my $dxchan = DXChannel::get($p); - if ($dxchan) { - push @dxchan, $dxchan unless grep $dxchan == $_, @dxchan; - } else { - next if grep $p eq $_, @_; - my $ref = Route::Node::get($p); -# dbg("Next node $p " . ($ref ? 'Found' : 'NOT Found') if isdbg('routech') ); - push @dxchan, $ref->alldxchan($self->{call}, @_) if $ref; - } - } - } -# dbg('routech', "Got dxchan: " . join(',', (map{ $_->call } @dxchan)) ); + my @dxchan = findroutes($self->{call}); return @dxchan; } @@ -359,16 +336,18 @@ sub dxchan return undef unless @dxchan; # determine the minimum ping channel - my $minping = 99999999; - foreach my $dxc (@dxchan) { - my $p = $dxc->pingave; - if (defined $p && $p < $minping) { - $minping = $p; - $dxchan = $dxc; - } - } - $dxchan = shift @dxchan unless $dxchan; - return $dxchan; +# my $minping = 99999999; +# foreach my $dxc (@dxchan) { +# my $p = $dxc->pingave; +# if (defined $p && $p < $minping) { +# $minping = $p; +# $dxchan = $dxc; +# } +# } +# $dxchan = shift @dxchan unless $dxchan; + + # dxchannels are now returned in order of "closeness" + return $dxchan[0]; }