sync the user database every 15 secs
authorminima <minima>
Wed, 26 Jul 2000 22:43:10 +0000 (22:43 +0000)
committerminima <minima>
Wed, 26 Jul 2000 22:43:10 +0000 (22:43 +0000)
Changes
perl/DXProt.pm
perl/DXUser.pm
perl/cluster.pl

diff --git a/Changes b/Changes
index e9d242df3deb24f875abddb0783b6b1647e3d2e9..3f0fc2c661c6513a093ea0375a8aec2ed1471b7d 100644 (file)
--- 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
index 50765e14a54be2b5f1912d7e82619db0c1002cf0..93baa8dae5759d60503ad7c6c967987141a35fa3 100644 (file)
@@ -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;
                                        }
index 6b1db816665c46f276cb5b3662b8918cc29db299..ad1b890cb7e7bbf34cabb150a3dffcd2fa51fc5a 100644 (file)
@@ -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 
 # 
index b96cf370b3162081628d7e355e66fe316215b1b3..cab4b0baf24339032f360f541bfb791049653f4d 100755 (executable)
@@ -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
                };