From cf0e4eb14cf2d18ce8012e20288f20abcbae665f Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 15 Jan 2007 21:40:01 +0000 Subject: [PATCH] fix deletions on pc92 config (finally)? --- perl/DXProtHandle.pm | 11 +++++++++-- perl/Route.pm | 6 ++++-- perl/Route/Node.pm | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index 51f40463..f04c6958 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -1399,7 +1399,7 @@ sub _del_thingy if ($is_node) { my $nref = Route::Node::get($call); @rout = $nref->del($parent) if $nref; - dbg("ROUTE: deleted node $call from " . $parent->call) if isdbg('route'); + dbg("ROUTE: deleting node $call from " . $parent->call) if isdbg('route'); } else { my $uref = Route::User::get($call); @rout = $parent->del_user($uref) if $uref; @@ -1563,13 +1563,20 @@ sub handle_92 my ($dnodes, $dusers, $nnodes, $nusers) = $parent->calc_config_changes(\@nodes, \@users); + # add users here foreach my $r (@nent) { my $call = $r->[0]; if ($call) { push @radd,_add_thingy($parent, $r) if grep $call eq $_, (@$nnodes, @$nusers); - push @rdel,_del_thingy($parent, $r) if grep $call eq $_, (@$dnodes, @$dusers); } } + # del users here + foreach my $r (@$dnodes) { + push @rdel,_del_thingy($parent, [$r, 1]); + } + foreach my $r (@$dusers) { + push @rdel,_del_thingy($parent, [$r, 0]); + } } else { dbg("PCPROT: unknown action '$sort', ignored") if isdbg('chanerr'); return; diff --git a/perl/Route.pm b/perl/Route.pm index abd3dcbb..6d5a3b01 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -199,8 +199,10 @@ sub config } if ($printit) { - $line = ' ' x ($level*2) . "$call"; - $call = ' ' x length $call; + my $pcall = "$call:" . $self->obscount; + + $line = ' ' x ($level*2) . "$pcall"; + $call = ' ' x length $pcall; # recursion detector if ((DXChannel::get($self->{call}) && $level > 1) || grep $self->{call} eq $_, @$seen) { diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm index ee1c9140..10a45eae 100644 --- a/perl/Route/Node.pm +++ b/perl/Route/Node.pm @@ -224,11 +224,25 @@ sub calc_config_changes my %users = map {$_ => 1} @{$self->{users}}; my $cnodes = shift; my $cusers = shift; + if (isdbg('route')) { + dbg("ROUTE: start calc_config_changes"); + dbg("ROUTE: incoming nodes on $self->{call}: " . join(',', sort @$cnodes)); + dbg("ROUTE: incoming users on $self->{call}: " . join(',', sort @$cusers)); + dbg("ROUTE: existing nodes on $self->{call}: " . join(',', sort keys %nodes)); + dbg("ROUTE: existing users on $self->{call}: " . join(',', sort keys %users)); + } my (@dnodes, @dusers, @nnodes, @nusers); push @nnodes, map {my @r = $nodes{$_} ? () : $_; delete $nodes{$_}; @r} @$cnodes; push @dnodes, keys %nodes; push @nusers, map {my @r = $users{$_} ? () : $_; delete $users{$_}; @r} @$cusers; push @dusers, keys %users; + if (isdbg('route')) { + dbg("ROUTE: deleted nodes on $self->{call}: " . join(',', sort @dnodes)); + dbg("ROUTE: deleted users on $self->{call}: " . join(',', sort @dusers)); + dbg("ROUTE: added nodes on $self->{call}: " . join(',', sort @nnodes)); + dbg("ROUTE: added users on $self->{call}: " . join(',', sort @nusers)); + dbg("ROUTE: end calc_config_changes"); + } return (\@dnodes, \@dusers, \@nnodes, \@nusers); } -- 2.43.0