- my $self = shift;
- my $pref = shift;
-
- # delete dxchan from this call's dxchan list
- $pref->_delnode($self);
- $self->_deldxchan($pref);
- my @nodes;
- my $ncall = $self->{call};
-
- # is this the last connection, I have no dxchan anymore?
- unless (@{$self->{dxchan}}) {
- foreach my $rcall (@{$self->{nodes}}) {
- next if grep $rcall eq $_, @_;
- my $r = Route::Node::get($rcall);
- push @nodes, $r->del($self, $ncall, @_) if $r;
- }
- $self->_del_users;
- delete $list{$self->{call}};
- push @nodes, $self;
- }
- return @nodes;
+ my ($self, $neighbour, $dxchan) = @_;
+ $self->_dellist('nodes', $neighbour);
+ $neighbour->_dellist('nodes', $self);
+ $neighbour->_dellist('dxchan', $dxchan) if $dxchan;
+ return $neighbour->is_empty('dxchan') ? ($neighbour) : ();