From: minima Date: Sat, 9 Jun 2001 13:53:17 +0000 (+0000) Subject: fix PC16 output problem X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea7e97b115dd46656a5aa7fabd19990e98a50df5;p=spider.git fix PC16 output problem --- diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 3f4575aa..dbe7faf8 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -35,7 +35,7 @@ use Route::Node; use strict; use vars qw($me $pc11_max_age $pc23_max_age - $last_hour %pings %rcmds + $last_hour $last10 %emph %pings %rcmds %nodehops $baddx $badspotter $badnode $censorpc $allowzero $decode_dk0wcy $send_opernam @checklist); @@ -52,6 +52,7 @@ $censorpc = 1; # Do a BadWords::check on text fields and reject things $baddx = new DXHash "baddx"; $badspotter = new DXHash "badspotter"; $badnode = new DXHash "badnode"; +$last10 = time; @checklist = ( @@ -1070,9 +1071,13 @@ sub normal # NOTE - don't arrive here UNLESS YOU WANT this lump of protocol to be # REBROADCAST!!!! # - - unless ($self->{isolate}) { - broadcast_ak1a($line, $self); # send it to everyone but me + + if (emph_dup($line)) { + dbg('chan', "PCPROT: Ephemeral dup, dropped"); + } else { + unless ($self->{isolate}) { + broadcast_ak1a($line, $self); # send it to everyone but me + } } } @@ -1108,14 +1113,17 @@ sub process } } } + + # every ten seconds + if ($t - $last10 >= 10) { + # clean out emphemera + + emph_clean(); + + $last10 = $t; + } - my $key; - my $val; - my $cutoff; if ($main::systime - 3600 > $last_hour) { -# Spot::process; -# Geomag::process; -# AnnTalk::process; $last_hour = $main::systime; } } @@ -1748,5 +1756,27 @@ sub route_pc21 broadcast_route($self, \&pc21, scalar @_, @_); } +sub emph_dup +{ + my $s = shift; + + # chop the end off + $s =~ s/\^H\d\d?\^?~?@//; + return 1 if exists $emph{$s}; + $emph{$s} = $main::systime; + return undef; +} + +sub emph_clean +{ + my ($key, $val); + + while (($key, $val) = each %emph) { + if ($main::systime - $val > 90) { + delete $emph{$key}; + } + } +} + 1; __END__ diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index 786d78c0..a9478812 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -78,8 +78,8 @@ sub pc16 my $ncall = $node->call; my @out; - my $str = "PC16^$ncall"; while (@_) { + my $str = "PC16^$ncall"; for ( ; @_ && length $str < 200; ) { my $ref = shift; $str .= sprintf "^%s %s %d", $ref->call, $ref->conf ? '*' : '-', $ref->here;