+12Jul07=======================================================================
+1. Change disconnection code so that nodes that are no longer routable are
+(all) cleared out.
11Jul07=======================================================================
1. improve speed of sh/c/n
2. remove all $Id$ strings from cmd tree
my $count;
# search thru the user for nodes
-if ($call[0] eq 'ALL') {
+if (@call == 0) {
+ @call = map {$_->call} DXChannel::get_all_nodes();
+} elsif ($call[0] eq 'ALL') {
shift @call;
my ($action, $key, $data) = (0,0,0);
for ($action = DXUser::R_FIRST, $count = 0; !$DXUser::dbm->seq($key, $data, $action); $action = DXUser::R_NEXT) {
push @call, $key;
++$count;
}
- }
-} elsif (@call == 0) {
- @call = map {$_->call} DXChannel::get_all_nodes();
+ }
}
my $call;
# do routing stuff, remove me from routing table
my $node = Route::Node::get($call);
- my @rout;
- if ($node) {
- @rout = $node->del($main::routeroot);
-
- # and all my ephemera as well
- for (@rout) {
- my $c = $_->call;
- eph_del_regex("^PC1[679].*$c");
- }
- }
RouteDB::delete_interface($call);
my $mref = DXMsg::get_busy($call);
$mref->stop_msg($call) if $mref;
- # broadcast to all other nodes that all the nodes connected to via me are gone
- unless ($pc39flag && $pc39flag == 2) {
- $self->route_pc21($main::mycall, undef, @rout) if @rout;
- $self->route_pc92d($main::mycall, undef, $main::routeroot, $node) if $node;
- }
-
# remove outstanding pings
delete $pings{$call};
Log('DXProt', $call . " Disconnected");
$self->SUPER::disconnect;
+
+ # here we determine what needs to go out of the routing table
+ my @rout;
+ if ($node) {
+ dbg('%Route::Node::List = ' . join(',', sort keys %Route::Node::list)) if isdbg('routedisc');
+
+ @rout = $node->del($main::routeroot);
+
+ dbg('@rout = ' . join(',', sort map {$_->call} @rout)) if isdbg('routedisc');
+
+ # now we need to see what can't be routed anymore and came
+ # in via this node (probably).
+ my $n = 0;
+ while ($n != @rout) {
+ $n = @rout;
+ for (Route::Node::get_all()) {
+ unless ($_->dxchan) {
+ push @rout, $_->delete;
+ }
+ }
+ dbg('@rout = ' . join(',', sort map {$_->call} @rout)) if isdbg('routedisc');
+ }
+
+ dbg('%Route::Node::List = ' . join(',', sort keys %Route::Node::list)) if isdbg('routedisc');
+
+ # and all my ephemera as well
+ for (@rout) {
+ my $c = $_->call;
+ eph_del_regex("^PC1[679].*$c");
+ }
+ }
+
+ # broadcast to all other nodes that all the nodes connected to via me are gone
+ unless ($pc39flag && $pc39flag == 2) {
+ $self->route_pc21($main::mycall, undef, @rout) if @rout;
+ $self->route_pc92d($main::mycall, undef, $main::routeroot, $node) if $node;
+ }
}
} elsif ($create) {
$parent = Route::Node->new($call);
}
- $parent->lastid->{$pc} = $t;
+ $parent->lastid->{$pc} = $t if $parent;
return $parent;
}
}
} elsif ($sort eq 'A' || $sort eq 'D' || $sort eq 'C') {
+ # remember the last channel we arrived on
+ $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call;
+
# this is the main route section
# here is where all the routes are created and destroyed
}
$parent = check_pc9x_t($call, $t, 92) || return;
$parent->via_pc92(1);
+ $parent->PC92C_dxchan($self->{call});
}
} else {
dbg("PCPROT: must be mycall or external node as first entry, ignored") if isdbg('chanerr');
$parent->here(Route::here($here));
$parent->version($version) if $version && $version > $parent->version;
$parent->build($build) if $build && $build > $parent->build;
+ $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call;
shift @ent;
}
}
# 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');
}
# deal with more nodes
my $nref = Route::get($call);
+ return () unless $nref;
foreach my $ncall (@{$nref->{parent}}) {
unless ($seen->{$ncall}) {
dbg("recursing from $call -> $ncall") if isdbg('routec');
push @nodes, $r->del($self, $ncall, @_) if $r;
}
$self->_del_users;
- delete $list{$self->{call}};
+ delete $list{$ncall};
push @nodes, $self;
}
return @nodes;
}
# this deletes this node completely by grabbing the parents
-# and deleting me from them
+# and deleting me from them, then deleting me from all the
+# dependent nodes.
sub delete
{
my $self = shift;
my @out;
+ my $ncall = $self->{call};
+ # get rid of users and parents
$self->_del_users;
- foreach my $call (@{$self->{parent}}) {
- my $parent = Route::Node::get($call);
- push @out, $parent->del($self) if $parent;
+ if (@{$self->{parent}}) {
+ foreach my $call (@{$self->{parent}}) {
+ my $parent = Route::Node::get($call);
+ push @out, $parent->del($self) if $parent;
+ }
+ }
+ # get rid of my nodes
+ push @out, $self->del_nodes;
+ # this only happens if we a orphan with no parents
+ if ($list{$ncall}) {
+ push @out, $self;
+ delete $list{$ncall};
}
return @out;
}
$self->{users} = [];
$self->{nodes} = [];
$self->{lastid} = {};
+ $self->{PC92C_dxchan} = '';
$self->reset_obs; # by definition
$list{$call} = $self;
$version = '1.54';
$subversion = '0';
-$build = '115';
+$build = '116';
1;