- # send 'my' configuration for all users and pc92 capable nodes
- my @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && $self->{do_pc92} } DXChannel::get_all();
- my @localnodes = map { my $r = Route::get($_->{call}); $r ? $r : () } @dxchan;
- $self->send_route_pc92($main::mycall, \&pc92c, scalar @localnodes, @localnodes);
-
- # send the configuration of all the 'external' nodes that don't handle PC92
- # out with the 'external' marker on the first node.
- @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} && !$_->{do_pc92} } DXChannel::get_all_nodes();
- @localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan;
- foreach $node (@localnodes) {
- if ($node) {
- my @rout = map {my $r = Route::User::get($_); $r ? ($r) : ()} $node->users;
- $self->send_route_pc92($main::mycall, \&pc92c, 1, $node, @rout) if @rout;
+ $node->last_PC92C(gen_my_pc92_config($node));
+ $self->send($node->last_PC92C);
+}
+
+sub broadcast_pc92_update
+{
+ my $self = shift;
+ my $call = shift;
+
+ dbg("ROUTE: broadcast_pc92_update $call") if isdbg('obscount');
+
+ my $nref = Route::Node::get($call);
+ unless ($nref) {
+ dbg("ERROR: broadcast_pc92_update - Route::Node $call disappeared");
+ return;
+ }
+ my $l = $nref->last_PC92C(gen_my_pc92_config($nref));
+ $nref->lastid(last_pc9x_id());
+ $main::me->broadcast_route_pc9x($main::mycall, undef, $l, 0);
+ $self->update_pc92_next;
+}
+
+sub broadcast_pc92_keepalive
+{
+ my $self = shift;
+ my $call = shift;
+
+ dbg("ROUTE: broadcast_pc92_keepalive $call") if isdbg('obscount');
+
+ my $nref = Route::Node::get($call);
+ unless ($nref) {
+ dbg("ERROR: broadcast_pc92_keepalive - Route::Node $call disappeared");
+ return;
+ }
+ my $l = pc92k($nref);
+ $nref->lastid(last_pc9x_id());
+ $main::me->broadcast_route_pc9x($main::mycall, undef, $l, 0);
+ $self->update_pc92_keepalive;
+}
+
+sub time_out_pc92_routes
+{
+ my @nodes = grep {$_->call ne $main::mycall && ($_->do_pc9x || $_->via_pc92)} Route::Node::get_all();
+ my @rdel;
+ foreach my $n (@nodes) {
+ my $o = $n->dec_obs;
+ if ($o <= 0) {
+ if (my $dxchan = DXChannel::get($n->call)) {
+ dbg("ROUTE: disconnecting local pc92 $dxchan->{call} on obscount") if isdbg('obscount');
+ $dxchan->disconnect;
+ next;
+ }
+ my @parents = map {Route::Node::get($_)} $n->parents;
+ for (@parents) {
+ if ($_) {
+ dbg("ROUTE: deleting pc92 $_->{call} from $n->{call} on obscount") if isdbg('obscount');
+ push @rdel, $n->del($_);
+ }
+ }