X-Git-Url: http://scm.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2FRoute.pm;h=72bb5db44b8afb42b7c3319dabfd41ab21b9430d;hb=05bed9a172a48255aff58f64ab01df58a4d87891;hp=2c53175fc645b13f4e0f6a6310d97cf7e4f3c8af;hpb=a2b44b1c0d70fb3439bef2456a7f950d87e65a0a;p=spider.git diff --git a/perl/Route.pm b/perl/Route.pm index 2c53175f..72bb5db4 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -301,6 +301,7 @@ sub findroutes push @out, $level ? [$level, $dxchan] : $dxchan; return @out; } + $seen->{$call}++; # deal with more nodes my $nref = Route::get($call); @@ -319,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; } @@ -358,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]; }