Fix the over midnight ID rollover calculation
authorDirk Koopman <djk@tobit.co.uk>
Fri, 6 Jul 2007 09:01:18 +0000 (10:01 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Fri, 6 Jul 2007 09:01:18 +0000 (10:01 +0100)
Also use a big enough past age limit to cope with inactive nodes
that only output a config record and nowt much else, so that they
don't time out.

Add an 'id too far in the future' compared with current systime
check.

Changes
perl/DXProtHandle.pm
perl/Version.pm

diff --git a/Changes b/Changes
index 5708fce2ff39e7c483a965ef2312ff8fc24bdbe1..138b8740a60e5cabd4631ec89f4de6c9f62c5e53 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+06Jul07=======================================================================
+1. re-arrange id checking so that it is more logical and check that config
+records, that can be an hour coming, are not thoughtlessly ignored, thus
+causing nodes to time out.
+2. Make sure that the 'over midnight' distance calculation actually does what
+is required!
 05Jul07=======================================================================
 1. Try to make sure that the node config broadcasts are actually sent...
 03Jul07=======================================================================
index 7d2968cedb626ccdc85be4a3e656eacdade0da57..a42ba33e871de8496d1f138414140ca37470d479 100644 (file)
@@ -46,7 +46,8 @@ use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restim
                        $eph_pc15_restime $pc9x_past_age $pc9x_future_age
                   );
 
-$pc9x_past_age = 15*60;                        # maximum age in the past of a px9x
+$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
 
 # incoming talk commands
@@ -1422,14 +1423,19 @@ sub check_pc9x_t
                if ($parent->call ne $main::mycall) {
                        my $lastid = $parent->lastid->{$pc} || 0;
                        if ($t < $lastid) {
-                               if ($lastid-86400+$t > $pc9x_past_age) {
-                                       dbg("PCPROT: dup id on $t <= $lastid (midnight rollover), ignored") if isdbg('chanerr');
+                               if ($t+86400-$lastid > $pc9x_past_age) {
+                                       dbg("PCPROT: dup id on $t <= $lastid, ignored") if isdbg('chanerr');
                                        return;
                                }
-                       }
-                       if ($lastid >= $t) {
-                               dbg("PCPROT: dup id on $call $lastid >= $t, ignored") if isdbg('chanerr');
+                       } 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');
+                                       return;
+                               }
                        }
                }
        } elsif ($create) {
index 3a0dca8b1874e11913b0702ceb013d2b662a835e..d6dc547597893b0a87243d03dd0085094f1d56cf 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '102';
+$build = '103';
 
 1;