X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute.pm;h=45bd7213e147eceb93bf3458f294b2dbd0b67a1c;hb=b9ac5347cb32b8511a9cec13ef89c14683df995e;hp=0e9b61395da39891f3bcf0a1957e7a6e8abdd87a;hpb=598233c22daef138cd7b0a653d3165b4a16905e2;p=spider.git diff --git a/perl/Route.pm b/perl/Route.pm index 0e9b6139..45bd7213 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -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; } @@ -308,47 +310,12 @@ sub bestdxchan my $dxchan = DXChannel->get($self->call); return $dxchan if $dxchan; - my @dxchan = $self->alldxchan; + my @dxchan = sort { ($a->pingave || 9999999) <=> ($b->pingave || 9999999) } $self->alldxchan; 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; -} - -sub _adddxchan -{ - my $self = shift; - return $self->_addlist('dxchan', @_); -} - -sub _deldxchan -{ - my $self = shift; - return $self->_dellist('dxchan', @_); + return shift @dxchan; } -sub _addnode -{ - my $self = shift; - return $self->_addlist('nodes', @_); -} - -sub _delnode -{ - my $self = shift; - return $self->_dellist('nodes', @_); -} - - # # track destruction #