Remove dupefile before restarting node.
authorDirk Koopman <djk@tobit.co.uk>
Tue, 17 Jul 2007 21:53:22 +0000 (22:53 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 17 Jul 2007 21:53:22 +0000 (22:53 +0100)
Also provide the clear/dupefile command to do it at runtime.

Changes
cmd/Commands_en.hlp
cmd/clear/dupefile.pl [new file with mode: 0644]
perl/DXDupe.pm
perl/Version.pm

diff --git a/Changes b/Changes
index f03ffc3e25dc5707473bc3dc10acc23fc1c6d7b7..64a1dc1d2adf96839f6cf5afef79bd4615248892 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+17Jul07=======================================================================
+1. remove dupefile on startup and on ending the node. Add clear/dupefile
+command to allow people to do it at runtime as well.
 12Jul07=======================================================================
 1. Change disconnection code so that nodes that are no longer routable are
 (all) cleared out.
index 74520ea39795deb005c238d245058fd97ea4d776..30c6aea54b06d84bedcc233c2f32bb7e94ed879e 100644 (file)
@@ -328,6 +328,21 @@ see CLEAR/SPOTS for a more detailed explanation.
 A sysop can clear an input or normal output filter for a user or the
 node_default or user_default. 
 
+=== 6^CLEAR/DUPEFILE^Clear out the dupefile completely
+The system maintains a list of duplicate announces and spots (amongst many
+other things). Sometimes this file gets corrupted during operation
+(although not very often). This command will remove the file and start
+again from scratch.
+
+Try this if you get several duplicate DX Spots, one after another.
+
+Please ONLY use this command if you have a problem. And then only once.
+If it does not cure your problem, then repeating the command won't help.
+Get onto the dxspider-support list and let us try to help.
+
+If you use this command frequently then you will cause other people, as
+well as yourself, a lot of problems with duplicates.
+
 === 0^CLEAR/ROUTE [1|all]^Clear a route filter line
 This command allows you to clear (remove) a line in a route filter or to 
 remove the whole filter.
diff --git a/cmd/clear/dupefile.pl b/cmd/clear/dupefile.pl
new file mode 100644 (file)
index 0000000..909f7f9
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# clear out and replace dupefile with an empty one
+#
+# Copyright (c) 2007 Dirk Koopman, G1TLH
+#
+#
+
+my ($self, $line) = @_;
+
+# are we permitted (we could allow fairly privileged people to do this)?
+return (1, $self->msg('e5')) if $self->priv < 6;
+
+DXDupe::finish();
+DXDupe::init();
+
+return (1, $self->msg('done'));
+
+
+
index 851e3a6953eef03450020f399a9efa2b4b17f42f..5b288d1f87b1b3f1d04f8f99caf8c485d3d0127f 100644 (file)
@@ -21,14 +21,9 @@ $fn = "$main::data/dupefile";
 
 sub init
 {
+       unlink $fn;
        $dbm = tie (%d, 'DB_File', $fn);
-       unless ($dbm) {
-               eval { untie %d };
-               dbg("Dupefile $fn corrupted, removing...");
-               unlink $fn;
-               $dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)";
-               confess "cannot open $fn $!" unless $dbm; 
-       }
+       confess "cannot open $fn $!" unless $dbm;
 }
 
 sub finish
@@ -36,6 +31,7 @@ sub finish
        undef $dbm;
        untie %d;
        undef %d;
+       unlink $fn;
 }
 
 sub check
index 479b37a2ae20c2798aab5c0d6ab4be21d2c09b53..db94a844e16089fa6341822eb829785b5755b42b 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '118';
+$build = '119';
 
 1;