From: minima Date: Mon, 21 Oct 2002 14:20:19 +0000 (+0000) Subject: fix msg aging X-Git-Tag: PRE-1-52~123 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=6af9f2685f27610ff519df7da4ce3934f6ca1d85;p=spider.git fix msg aging make pingint and obscount defaults set/var able --- diff --git a/Changes b/Changes index 5abd7d07..666930a5 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +21Oct02======================================================================= +1. Fix msg aging. +2. make the default pinginterval and obscount variable (set/var +$DXProt::pingint and $DXProt::obscount) 20Oct02======================================================================= 1. remove dupe check on local sysop announces 2. fix format errors on sh/muf for 5.8.0 diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 11032115..66194e1b 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1504,7 +1504,7 @@ Tell the system what your name is eg:- Tell the system that the call(s) are to be treated as AK1A cluster and fed PC Protocol rather normal user commands. -=== 8^SET/OBSCOUNT ^Set the 'pump-up' obscelence counter +=== 8^SET/OBSCOUNT ^Set the 'pump-up' obscelence PING counter From 1.35 onwards neighbouring nodes are pinged at regular intervals (see SET/PINGINTERVAL), usually 300 seconds or 5 minutes. There is a 'pump-up' counter which is decremented on every outgoing ping and then reset to diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 10d1e4dc..e8598085 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -125,7 +125,7 @@ sub alloc $self->{'read'} = shift; $self->{rrreq} = shift; $self->{delete} = shift; - $self->{deletetime} = shift; + $self->{deletetime} = shift || $self->{delete} ? 0 : ($self->{t} + $maxage); $self->{gotit} = []; # $self->{lastt} = $main::systime; $self->{lines} = []; @@ -155,6 +155,15 @@ sub process # clean the message queue clean_old() if $main::systime - $last_clean > 3600 ; + + # actual remove all the 'deleted' messages in one hit. + # this has to be delayed until here otherwise it only does one at + # a time because @msg is rewritten everytime del_msg is called. + my @del = grep {!$_->{tonode} && $_->{delete} && $_->{deletetime} < $main::systime} @msg; + for (@del) { + $_->del_msg; + } + $last_clean = $main::systime; return; } @@ -512,7 +521,7 @@ sub store my $rr = $ref->{rrreq} ? '1' : '0'; my $priv = $ref->{private} ? '1': '0'; my $del = $ref->{delete} ? '1' : '0'; - my $delt = $ref->{deletetime} || '0'; + my $delt = $ref->{deletetime} || $ref->{t} + $maxage; print $fh "=== $ref->{msgno}^$ref->{to}^$ref->{from}^$ref->{t}^$priv^$ref->{subject}^$ref->{origin}^$ref->{'read'}^$rr^$del^$delt\n"; print $fh "=== ", join('^', @{$ref->{gotit}}), "\n"; my $line; @@ -530,13 +539,6 @@ sub store } } - # actual remove all the 'deleted' messages in one hit. - # this has to be delayed until here otherwise it only does one at - # a time because @msg is rewritten everytime del_msg is called. - my @del = grep {!$_->{tonode} && $_->{delete} && $_->{deletetime} < $main::systime} @msg; - for (@del) { - $_->del_msg; - } } # delete a message @@ -589,7 +591,7 @@ sub clean_old # mark old messages for deletion foreach $ref (@msg) { - if (ref($ref) && !$ref->{keep} && $ref->{t} < $main::systime - $maxage) { + if (ref($ref) && !$ref->{keep} && $ref->{deletetime} < $main::systime) { # this is for IMMEDIATE destruction $ref->{delete}++; diff --git a/perl/DXProt.pm b/perl/DXProt.pm index f0fe0c6e..330e7a60 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -44,6 +44,7 @@ $main::branch += $BRANCH; use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restime $eph_pc34_restime $last_hour $last10 %eph %pings %rcmds $ann_to_talk + $pingint $obscount %nodehops $baddx $badspotter $badnode $censorpc $rspfcheck $allowzero $decode_dk0wcy $send_opernam @checklist); @@ -65,6 +66,8 @@ $rspfcheck = 1; $eph_restime = 180; $eph_info_restime = 60*60; $eph_pc34_restime = 30; +$pingint = 5*60; +$obscount = 2; @checklist = ( @@ -255,9 +258,9 @@ sub start # ping neighbour node stuff my $ping = $user->pingint; - $ping = 5*60 unless defined $ping; + $ping = $pingint unless defined $ping; $self->{pingint} = $ping; - $self->{nopings} = $user->nopings || 2; + $self->{nopings} = $user->nopings || $obscount; $self->{pingtime} = [ ]; $self->{pingave} = 999; $self->{metric} ||= 100; diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index e497a6e9..219e9f3b 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -149,6 +149,7 @@ sub promptf $dd->Terse(1); $dd->Quotekeys(0); $value = $dd->Dumpxs; + $value =~ s/([\r\n\t])/sprintf("%%%02X", ord($1))/eg; } $prompt = sprintf "%15s: %s", $prompt, $value; return ($priv, $prompt);