From: Dirk Koopman Date: Sat, 23 Jun 2007 13:05:07 +0000 (+0100) Subject: fix pc20 disconnect X-Git-Tag: 1.55~149 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=b58ca3b5845f03a444f401ba5fdc1d054f853492;p=spider.git fix pc20 disconnect --- diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 2130e3c3..2c9cda2d 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -44,7 +44,7 @@ use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restim %nodehops $baddx $badspotter $badnode $censorpc $rspfcheck $allowzero $decode_dk0wcy $send_opernam @checklist $eph_pc15_restime $pc92_update_period $pc92_obs_timeout - %pc92_find $pc92_find_timeout + %pc92_find $pc92_find_timeout $pc92_short_update_period ); $pc11_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc11 @@ -74,6 +74,7 @@ $chatimportfn = "$main::root/chat_import"; $investigation_int = 12*60*60; # time between checks to see if we can see this node $pc19_version = 5466; # the visible version no for outgoing PC19s generated from pc59 $pc92_update_period = 60*60; # the period between PC92 C updates +$pc92_short_update_period = 15*60; # shorten the update period after a connection %pc92_find = (); # outstanding pc92 find operations $pc92_find_timeout = 30; # maximum time to wait for a reply $pc92_obs_timeout = $pc92_update_period; # the time between obscount countdowns @@ -206,7 +207,8 @@ sub check sub update_pc92_next { my $self = shift; - $self->{next_pc92_update} = $main::systime + $pc92_update_period - int rand($pc92_update_period / 4); + my $period = shift || $pc92_update_period; + $self->{next_pc92_update} = $main::systime + $period - int rand($period / 4); } sub init @@ -229,7 +231,7 @@ sub init $main::me->{version} = $main::version; $main::me->{build} = "$main::subversion.$main::build"; $main::me->{do_pc9x} = 1; - $main::me->update_pc92_next; + $main::me->update_pc92_next($pc92_update_period); } # @@ -338,8 +340,8 @@ sub start my $script = new Script(lc $call) || new Script('node_default'); $script->run($self) if $script; - # set next_pc92_update time - $self->update_pc92_next; + # set next_pc92_update time for this node sooner + $self->update_pc92_next($pc92_short_update_period); } # @@ -450,7 +452,7 @@ sub process # send out a PC92 config record if required if ($main::systime >= $dxchan->{next_pc92_update}) { $dxchan->send_pc92_config; - $dxchan->update_pc92_next; + $dxchan->update_pc92_next($pc92_update_period); } } diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index d739d65d..b5a8bcdc 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -796,7 +796,7 @@ sub handle_20 $self->send(pc22()); $self->state('normal'); $self->{lastping} = 0; - $self->route_pc92a($main::mycall, $line, $main::routeroot, Route::Node::get($self->{call})); + $self->route_pc92a($main::mycall, undef, $main::routeroot, Route::Node::get($self->{call})); } # delete a cluster from the list @@ -1555,39 +1555,49 @@ sub handle_92 # here is where all the routes are created and destroyed my @ent = map {[ _decode_pc92_call($_) ]} grep {$_ && /^[0-7]/} @_[4 .. $#_]; + if (@ent) { # look at the first one which will always be a node of some sort - # and update any information that needs to be done. + # except in the case of 'A' or 'D' in which the $pcall is used + # otherwise use the node call and update any information + # that needs to be done. my ($call, $is_node, $is_extnode, $here, $version, $build) = @{$ent[0]}; - if ($call && $is_node) { - if ($call eq $main::mycall) { - dbg("PCPROT: $call looped back onto $main::mycall, ignored") if isdbg('chanerr'); - return; - } - if ($is_extnode) { - # this is only accepted from my "self" - if (DXChannel::get($call) && $call ne $self->{call}) { - dbg("PCPROT: locally connected node config for $call from other another node $self->{call}, ignored") if isdbg('chanerr'); + if (($sort eq 'A' || $sort eq 'D') && !$is_node) { + # parent is already set correctly + # this is to allow shortcuts for A and D records + # not repeating the origin call to no real purpose + ; + } else { + if ($call && $is_node) { + if ($call eq $main::mycall) { + dbg("PCPROT: $call looped back onto $main::mycall, ignored") if isdbg('chanerr'); return; } - # 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) { + # this is only accepted from my "self" + if (DXChannel::get($call) && $call ne $self->{call}) { + dbg("PCPROT: locally connected node config for $call from other another node $self->{call}, ignored") if isdbg('chanerr'); + return; + } + # 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; + } + $parent = check_pc9x_t($call, $t, 92) || return; + $parent->via_pc92(1); } - $parent = check_pc9x_t($call, $t, 92) || return; - $parent->via_pc92(1); + } else { + dbg("PCPROT: must be mycall or external node as first entry, ignored") if isdbg('chanerr'); + return; } - } else { - dbg("PCPROT: must be mycall or external node as first entry, ignored") if isdbg('chanerr'); - return; + $parent->here(Route::here($here)); + $parent->version($version) if $version && $version > $parent->version; + $parent->build($build) if $build && $build > $parent->build; + shift @ent; } - $parent->here(Route::here($here)); - $parent->version($version) if $version && $version > $parent->version; - $parent->build($build) if $build && $build > $parent->build; - shift @ent; } # do a pass through removing any references to either locally connected nodes or mycall @@ -1650,6 +1660,9 @@ sub handle_92 foreach my $r (@$dusers) { push @rdel,_del_thingy($parent, [$r, 0]); } + + # remember this last PC92C for rebroadcast on demand + $parent->last_PC92C($line); } else { dbg("PCPROT: unknown action '$sort', ignored") if isdbg('chanerr'); return; diff --git a/perl/Version.pm b/perl/Version.pm index 237f919c..904270c6 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 = '65'; +$build = '66'; 1;