From ac14c6983861c08b8a2842af46e67407600f8065 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Sun, 24 Jun 2007 21:15:23 +0100 Subject: [PATCH] connect up the discontinuous trees and route better This involves making sure that all the external nodes get fixed up even though their parent node does not yet exist (because no config record has come in. It is safe to create these, in anticipation of the C record coming in somewhen. In the process of this, obscount reseting now happens much more frequently (which I hope means correctly). Allow Route::findroutes to find routes to these disconnected nodes that are in the routing table but have no parent that is yet anchored to a dxchan. Simply remember the dxchan that that C record came in on. It doesn't matter if it gets overwritten by another node, if it came in that way, there must be a route. In any case, chances are, the first dxchan to get the C record is the best and the deduping will (mostly) prevent it being overwritten. When the linking C record comes in, it is all irrelevant anyway... --- Changes | 4 ++++ perl/DXProtHandle.pm | 11 +++++++++-- perl/Route.pm | 31 +++++++++++++++++++++++++++++-- perl/Route/Node.pm | 1 + perl/Version.pm | 2 +- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 0dee640f..ded4c90e 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +24Jun06======================================================================= +1. Fix the routing algorithms to allow route selection in the face of +incomplete trees of nodes (trees as produced by sh/newc). +2. Fix the obscout issues which mean that many nodes get timed out after 3hrs. 23Jun06======================================================================= 1. fix basic deduping algorithm 2. rearrange node startup protocol to avoid issuing unnecessary PC92 and also diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index 4a2be357..b83da417 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -1553,8 +1553,13 @@ sub handle_92 # reparent to external node (note that we must have received a 'C' or 'A' record # from the true parent node for this external before we get one for the this node unless ($parent = Route::Node::get($call)) { - dbg("PCPROT: no previous C or A for this external node received, ignored") if isdbg('chanerr'); - return; + if ($is_extnode && $oparent) { + @radd = _add_thingy($oparent, $ent[0]); + $parent = $radd[0]; + } else { + dbg("PCPROT: no previous C or A for this external node received, ignored") if isdbg('chanerr'); + return; + } } $parent = check_pc9x_t($call, $t, 92) || return; $parent->via_pc92(1); @@ -1594,9 +1599,11 @@ sub handle_92 # we only reset obscounts on config records $oparent->reset_obs; + $oparent->PC92C_dxchan($self->{call}) unless $self->{call} eq $oparent->call; dbg("ROUTE: reset obscount on $pcall now " . $oparent->obscount) if isdbg('obscount'); if ($oparent != $parent) { $parent->reset_obs; + $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call; dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount'); } diff --git a/perl/Route.pm b/perl/Route.pm index 415d1744..51fceff5 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -200,7 +200,7 @@ sub config $pcall .= ":" . $self->obscount if isdbg('obscount'); - $line = ' ' x ($level*2) . "$pcall"; + $line = ' ' x ($level*2) . $pcall; $pcall = ' ' x length $pcall; # recursion detector @@ -313,7 +313,34 @@ sub findroutes } } - return $level == 0 ? map {$_->[1]} sort {$a->[0] <=> $b->[0]} @out : @out; + if ($level == 0) { + my @nout = map {$_->[1]} sort {$a->[0] <=> $b->[0]} @out; + my $last; + if ($nref->isa('Route::Node')) { + my $ncall = $nref->PC92C_dxchan; + $last = DXChannel::get($ncall) if $ncall; + } else { + my $pcall = $nref->{parent}->[0]; + my ($ref, $ncall); + $ref = Route::Node::get($pcall) if $pcall; + $ncall = $ref->PC92C_dxchan if $ref; + $last = DXChannel::get($ncall) if $ncall; + } + + if (isdbg('findroutes')) { + if (@out) { + foreach (sort {$a->[0] <=> $b->[0]} @out) { + dbg("ROUTE: findroute $call -> $_->[0] " . $_->[1]->call); + } + } else { + dbg("ROUTE: findroute $call -> PC92C_dxchan " . $last->call) if $last; + } + } + push @nout, $last if @out == 0 && $last; + return @nout; + } else { + return @out; + } } # find all the possible dxchannels which this object might be on diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm index a9bb2a44..3fa7a097 100644 --- a/perl/Route/Node.pm +++ b/perl/Route/Node.pm @@ -32,6 +32,7 @@ use vars qw(%list %valid @ISA $max $filterdef $obscount); via_pc92 => '0,Came in via pc92,yesno', obscount => '0,Obscount', last_PC92C => '9,Last PC92C', + PC92C_dxchan => '9,Channel of PC92C', ); $filterdef = $Route::filterdef; diff --git a/perl/Version.pm b/perl/Version.pm index 04706cbe..703e9baf 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.54'; $subversion = '0'; -$build = '84'; +$build = '85'; 1; -- 2.34.1