]> dxcluster.org Git - spider.git/commitdiff
make Route::findroutes the basis of all routing
authorDirk Koopman <djk@tobit.co.uk>
Sun, 24 Jun 2007 00:03:03 +0000 (01:03 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sun, 24 Jun 2007 00:03:03 +0000 (01:03 +0100)
perl/DXProtHandle.pm
perl/Route.pm
perl/Version.pm

index d4ef2c1d849b40fe46abbe03a3c5a9753ca658c5..d55e15e362ecec7b5e83d8f5cac7ee563d548019 100644 (file)
@@ -1744,14 +1744,16 @@ sub handle_93
                # convert to PC10 talks where appropriate
                my $ref = Route::get($to);
                if ($ref) {
-                       my @dxchan = $ref->alldxchan;
-                       for $dxchan (@dxchan) {
+                       # just go for the "best" one for now (rather than broadcast)
+                       $dxchan = $ref->dxchan;
+#                      my @dxchan = $ref->alldxchan;
+#                      for $dxchan (@dxchan) {
                                if ($dxchan->{do_pc9x}) {
                                        $dxchan->send($line);
                                } else {
                                        $dxchan->talk($from, $to, $via, $text, $onode);
                                }
-                       }
+#                      }
                        return;
                }
 
index 860c5235176449a59a8842b798785a16d8c47ae4..72bb5db44b8afb42b7c3319dabfd41ab21b9430d 100644 (file)
@@ -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];
 }
 
 
index 2c592a720deb5916fdb1e2d313201d30674c5641..929da4702bdef348d52b0d0c8317539782a99f50 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '79';
+$build = '80';
 
 1;