X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProtHandle.pm;h=4c7ccf4b256d869e4b6f57910d11e24a1b2214a7;hb=7b35ba0ffde25a7ef028c82b77021bab4b010900;hp=d73bbc62c77a448aaed8278d61025daed5654b97;hpb=8320b88d08622ad45f3b68c551bdb53762060f79;p=spider.git diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index d73bbc62..4c7ccf4b 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -2,7 +2,7 @@ # # This module impliments the handlers for the protocal mode for a dx cluster # -# Copyright (c) 1998-2006 Dirk Koopman G1TLH +# Copyright (c) 1998-2007 Dirk Koopman G1TLH # # # @@ -45,11 +45,12 @@ use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restim $allowzero $decode_dk0wcy $send_opernam @checklist $eph_pc15_restime $pc9x_past_age $pc9x_future_age $pc10_dupe_age $pc92_slug_changes $last_pc92_slug + $pc92Ain $pc92Cin $pc92Din $pc92Kin ); $pc9x_past_age = 62*60; # maximum age in the past of a px9x (a config record might be the only # thing a node might send - once an hour) -$pc9x_future_age = 5*60; # maximum age in the future ditto +$pc9x_future_age = 2*3600; # maximum age in the future ditto $pc10_dupe_age = 45; # just something to catch duplicate PC10->PC93 conversions $pc92_slug_changes = 60; # slug any changes going outward for this long $last_pc92_slug = 0; # the last time we sent out any delayed add or del PC92s @@ -1485,20 +1486,22 @@ sub check_pc9x_t # the id on it is completely unreliable. Besides, only commands # originating on this box will go through this code... if ($parent->call ne $main::mycall) { - my $lastid = $parent->lastid || 0; - if ($t < $lastid) { - if ($t+86400-$lastid > $pc9x_past_age) { - dbg("PCPROT: dup id on $t <= $lastid, ignored") if isdbg('chanerr'); - return; - } - } elsif ($t == $lastid) { - dbg("PCPROT: dup id on $t == $lastid, ignored") if isdbg('chanerr'); - return; - } else { - # $t > $lastid, check that the timestamp offered isn't too far away from 'now' - if ($t+$main::systime_daystart-$main::systime > $pc9x_future_age ) { - dbg("PCPROT: id $t too far in the future, ignored") if isdbg('chanerr'); + my $lastid = $parent->lastid; + if (defined $lastid) { + if ($t < $lastid) { + if ($t+86400-$lastid > $pc9x_past_age) { + dbg("PCPROT: dup id on $t <= lastid $lastid, ignored") if isdbg('chanerr'); + return; + } + } elsif ($t == $lastid) { + dbg("PCPROT: dup id on $t == lastid $lastid, ignored") if isdbg('chanerr'); return; + } else { + # $t > $lastid, check that the timestamp offered isn't too far away from 'now' + if ($t-$lastid > $pc9x_future_age ) { + dbg("PCPROT: id $t too far in the future of lastid $lastid, ignored") if isdbg('chanerr'); + return; + } } } } @@ -1557,7 +1560,7 @@ sub pc92_handle_first_slot } $parent->here(Route::here($here)); $parent->version($version || $pc19_version) if $version; - $parent->build($build) if $build && $build > $parent->build; + $parent->build($build) if $build; $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call; return ($parent, @radd); } @@ -1649,6 +1652,8 @@ sub handle_92 } } elsif ($sort eq 'K') { + $pc92Kin += length $line if $sort eq 'K'; + # remember the last channel we arrived on $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call; @@ -1662,28 +1667,28 @@ sub handle_92 push @radd, $add if $add; $parent->reset_obs; + $parent->version($ent[4]) if $ent[4]; + $parent->build($ent[5]) if $ent[5]; + dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount'); } } elsif ($sort eq 'A' || $sort eq 'D' || $sort eq 'C') { + $pc92Ain += length $line if $sort eq 'A'; + $pc92Cin += length $line if $sort eq 'C'; + $pc92Din += length $line if $sort eq 'D'; + # 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 - # cope with missing duplicate node calls in the first slot for A or D + # cope with missing duplicate node calls in the first slot my $me = $_[4] || ''; - if (($sort eq 'A' || $sort eq 'D')) { - $me ||= _encode_pc92_call($parent) if !$me ; - } else { - unless ($me) { - dbg("PCPROT: this type of PC92 *must* have a node call in the first slot, ignored") if is_dbg('chanerr'); - return; - } - } + $me ||= _encode_pc92_call($parent) unless $me ; - my @ent = map {[ _decode_pc92_call($_) ]} grep {$_ && /^[0-7]/} $me, @_[5 .. $#_]; + my @ent = map {my @a = _decode_pc92_call($_); @a ? \@a : ()} grep {$_ && /^[0-7]/} $me, @_[5 .. $#_]; if (@ent) { @@ -1703,7 +1708,7 @@ sub handle_92 # do a pass through removing any references to either locally connected nodes or mycall my @nent; for (@ent) { - next unless $_; + next unless $_ && @$_; if ($_->[0] eq $main::mycall || DXChannel::get($_->[0])) { dbg("PCPROT: $_->[0] refers to locally connected node, ignored") if isdbg('chanerr'); next;