From 080a66c38925314321249190eb5a4dc572636d4b Mon Sep 17 00:00:00 2001 From: minima Date: Wed, 26 Jul 2000 22:43:10 +0000 Subject: [PATCH] sync the user database every 15 secs --- Changes | 2 ++ perl/DXProt.pm | 9 +++++++++ perl/DXUser.pm | 25 ++++++++++++++++++++++--- perl/cluster.pl | 3 +++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index e9d242df..3f0fc2c6 100644 --- a/Changes +++ b/Changes @@ -21,6 +21,8 @@ a month). This isn't the default - set $send_opernam in /spider/local/DXProtVars.pm (copied from /spider/perl). Good for gateways. 13. Despace spot texts properly again for deduping purposes. 14. Corrected Pc84/85 handling a bit. +15. Sync the user database every 15 secs to see whether we can reduce the +corruptions and duplicates. 25Jul00======================================================================= 1. ignore \n in ax25 mode for C client. 2. remove extra space at the end of a DX spot announce when no grid square diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 50765e14..93baa8da 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -271,6 +271,15 @@ sub normal } else { route(undef, $to, pc34($main::mycall, $to, $cmd)); } + if ($to ne $field[7]) { + $to = $field[7]; + $node = DXCluster->get_exact($to); + if ($node && $node->dxchan && $node->dxchan->is_clx) { + route(undef, $to, pc84($main::mycall, $to, $main::mycall, $cmd)); + } else { + route(undef, $to, pc34($main::mycall, $to, $cmd)); + } + } $user->lastoper($main::systime); $user->put; } diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 6b1db816..ad1b890c 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -19,12 +19,13 @@ use IO::File; use DXDebug; use strict; -use vars qw(%u $dbm $filename %valid $lastoperinterval); +use vars qw(%u $dbm $filename %valid $lastoperinterval $lasttime); %u = (); $dbm = undef; $filename = undef; $lastoperinterval = 30*24*60*60; +$lasttime = 0; # hash of valid elements and a simple prompt %valid = ( @@ -105,6 +106,17 @@ sub init use strict; +# +# periodic processing +# +sub process +{ + if ($main::systime > $lasttime + 15) { + $dbm->sync; + $lasttime = $main::systime; + } +} + # # close the system # @@ -192,7 +204,6 @@ sub put delete $self->{annok} if $self->{annok}; delete $self->{dxok} if $self->{dxok}; $u{$call} = $self->encode(); - $dbm->sync; } # @@ -234,7 +245,6 @@ sub del for ($dbm->get_dup($call)) { $dbm->del_dup($call, $_); } - $dbm->sync; } # @@ -248,6 +258,15 @@ sub close $self->put(); } +# +# sync the database +# + +sub sync +{ + $dbm->sync; +} + # # return a list of valid elements # diff --git a/perl/cluster.pl b/perl/cluster.pl index b96cf370..cab4b0ba 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -188,6 +188,8 @@ sub cease $SIG{'TERM'} = 'IGNORE'; $SIG{'INT'} = 'IGNORE'; + DXUser::sync; + eval { Local::finish(); # end local processing }; @@ -404,6 +406,7 @@ for (;;) { DXConnect::process(); DXMsg::process(); DXDb::process(); + DXUser::process(); eval { Local::process(); # do any localised processing }; -- 2.43.0