X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2FRoute.pm;h=7858e16ce7500dcce1864b07e2ba4f857cd1cd77;hb=870623b38dea43fbd5acf992d1e533cf3c6597cc;hp=388aed2e15056e0853c1a7f7dd538d83909ce501;hpb=05a7fdd4a58c51e21b55b0509b054b625839290c;p=spider.git diff --git a/perl/Route.pm b/perl/Route.pm index 388aed2e..7858e16c 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -37,7 +37,7 @@ use vars qw(%list %valid $filterdef); cq => '0,CQ Zone', state => '0,State', city => '0,City', - lastseen => 'Last Seen,atime', + lastseen => '0,Last Seen,atime', ); $filterdef = bless ([ @@ -152,7 +152,8 @@ sub here my $r = shift; return $self ? 2 : 0 unless ref $self; return ($self->{flags} & 2) ? 1 : 0 unless defined $r; - $self->{flags} = (($self->{flags} & ~2) | ($r ? 2 : 0)); + $self->{flags} &= ~2; + $self->{flags} |= $r ? 2 : 0; return $r ? 1 : 0; } @@ -162,7 +163,8 @@ sub conf my $r = shift; return $self ? 1 : 0 unless ref $self; return ($self->{flags} & 1) ? 1 : 0 unless defined $r; - $self->{flags} = (($self->{flags} & ~1) | ($r ? 1 : 0)); + $self->{flags} &= ~1; + $self->{flags} |= $r ? 1 : 0; return $r ? 1 : 0; } @@ -199,8 +201,8 @@ sub config # recursion detector if ((DXChannel->get($self->{call}) && $level > 1) || grep $self->{call} eq $_, @$seen) { - $line .= ' ...'; - push @out, $line; +# $line .= ' ...'; +# push @out, $line; return @out; } push @$seen, $self->{call}; @@ -269,20 +271,35 @@ sub get return Route::Node::get($call) || Route::User::get($call); } +sub get_all +{ + return (Route::Node::get_all(), Route::User::get_all()); +} + # find all the possible dxchannels which this object might be on 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; + if ($dxchan) { + dbg("alldxchan for $self->{call} = $dxchan->{call}") if isdbg('routelow'); + return $dxchan if $dxchan; + } + + my @nodes; + if ($self->isa('Route::User')) { + push @nodes, map{Route::Node::get($_)} @{$self->{nodes}}; + } elsif ($self->isa('Route::Node')) { + push @nodes, $self; + } # it isn't, build up a list of dxchannels and possible ping times # for all the candidates. - unless (@dxchan) { - foreach my $p (@{$self->{dxchan}}) { + my @dxchan; + foreach my $nref (@nodes) { + next unless $nref; + foreach my $p (@{$nref->{dxchan}}) { # dbg("Trying dxchan $p") if isdbg('routech'); next if $p eq $main::mycall; # the root my $dxchan = DXChannel->get($p); @@ -296,7 +313,7 @@ sub alldxchan } } } -# dbg('routech', "Got dxchan: " . join(',', (map{ $_->call } @dxchan)) ); + dbg("alldxchan for $self->{call} = (" . join(',', @dxchan) . ")") if isdbg('routelow'); return @dxchan; }