From 58234eafde7d75028574ae6aa519d2197120c558 Mon Sep 17 00:00:00 2001 From: minima Date: Sat, 9 Jun 2001 16:03:27 +0000 Subject: [PATCH] added a load of eph changes --- cmd/forward/opername.pl | 24 ++++++++++++++++++++---- cmd/set/here.pl | 8 ++++++-- cmd/set/homenode.pl | 4 +++- cmd/set/location.pl | 4 +++- cmd/set/name.pl | 4 +++- cmd/set/qra.pl | 4 +++- cmd/set/qth.pl | 4 +++- cmd/unset/here.pl | 8 ++++++-- perl/DXProt.pm | 20 ++++++++++---------- 9 files changed, 57 insertions(+), 23 deletions(-) diff --git a/cmd/forward/opername.pl b/cmd/forward/opername.pl index 314a9e37..57af6505 100644 --- a/cmd/forward/opername.pl +++ b/cmd/forward/opername.pl @@ -30,10 +30,26 @@ foreach $call (@f) { my $long = $ref->long; my $node = $ref->homenode; my $latlong = DXBearing::lltos($lat, $long) if $lat && $long; - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 1, $name), $DXProt::me) if $name; - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 2, $qth), $DXProt::me) if $qth; - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 3, $latlong), $DXProt::me) if $latlong; - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 4, $node), $DXProt::me) if $node; + if ($name) { + my $l = DXProt::pc41($call, 1, $name); + DXProt::eph_dup($l); + DXProt::broadcast_all_ak1a($l, $DXProt::me) ; + } + if ($qth) { + my $l = DXProt::pc41($call, 2, $qth); + DXProt::eph_dup($l); + DXProt::broadcast_all_ak1a($l, $DXProt::me) ; + } + if ($latlong) { + my $l = DXProt::pc41($call, 3, $latlong); + DXProt::eph_dup($l); + DXProt::broadcast_all_ak1a($l, $DXProt::me) ; + } + if ($node) { + my $l = DXProt::pc41($call, 4, $node); + DXProt::eph_dup($l); + DXProt::broadcast_all_ak1a($l, $DXProt::me) ; + } } } diff --git a/cmd/set/here.pl b/cmd/set/here.pl index e3d56f3e..8d5665c9 100644 --- a/cmd/set/here.pl +++ b/cmd/set/here.pl @@ -21,10 +21,14 @@ foreach $call (@args) { $dxchan->here(1); push @out, $self->msg('heres', $call); if ($ref) { - DXProt::broadcast_all_ak1a(DXProt::pc24($ref), $DXProt::me) ; + my $s = DXProt::pc24($ref); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; $ref->here(1); } elsif ($ref = Route::Node::get($call)) { - DXProt::broadcast_all_ak1a(DXProt::pc24($ref), $DXProt::me) ; + my $s = DXProt::pc24($ref); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; $ref->here(1); } else { $ref = Route::Node::get($call); diff --git a/cmd/set/homenode.pl b/cmd/set/homenode.pl index 5d3cb413..cf8d9715 100644 --- a/cmd/set/homenode.pl +++ b/cmd/set/homenode.pl @@ -22,7 +22,9 @@ if ($user) { $line = uc $line; $user->homenode($line); $user->put(); - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 4, $line), $DXProt::me); + my $s = DXProt::pc41($call, 4, $line); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; return (1, $self->msg('hnode', $line)); } else { return (1, $self->msg('namee2', $call)); diff --git a/cmd/set/location.pl b/cmd/set/location.pl index 8d1f1350..25db6ba6 100644 --- a/cmd/set/location.pl +++ b/cmd/set/location.pl @@ -24,7 +24,9 @@ if ($user) { my ($lat, $long) = DXBearing::stoll($line); $user->lat($lat); $user->long($long); - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 3, $line), $DXProt::me); + my $s = DXProt::pc41($call, 3, $line); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; unless ($user->qra && DXBearing::is_qra($user->qra) ) { my $qra = DXBearing::lltoqra($lat, $long); $user->qra($qra); diff --git a/cmd/set/name.pl b/cmd/set/name.pl index 6f76ea60..32917574 100644 --- a/cmd/set/name.pl +++ b/cmd/set/name.pl @@ -21,7 +21,9 @@ $user = DXUser->get_current($call); if ($user) { $user->name($line); $user->put(); - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 1, $line), $DXProt::me); + my $s = DXProt::pc41($call, 1, $line); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; return (1, $self->msg('name', $line)); } else { return (1, $self->msg('namee2', $call)); diff --git a/cmd/set/qra.pl b/cmd/set/qra.pl index 1bdc1cec..484666ca 100644 --- a/cmd/set/qra.pl +++ b/cmd/set/qra.pl @@ -26,7 +26,9 @@ if ($user) { $user->lat($lat); $user->long($long); my $s = DXBearing::lltos($lat, $long); - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 3, $s), $DXProt::me); + my $l = DXProt::pc41($call, 3, $s); + DXProt::eph_dup($l); + DXProt::broadcast_all_ak1a($l, $DXProt::me) ; } $user->put(); diff --git a/cmd/set/qth.pl b/cmd/set/qth.pl index 567208c7..2b696f94 100644 --- a/cmd/set/qth.pl +++ b/cmd/set/qth.pl @@ -21,7 +21,9 @@ $user = DXUser->get_current($call); if ($user) { $user->qth($line); $user->put(); - DXProt::broadcast_all_ak1a(DXProt::pc41($call, 2, $line), $DXProt::me); + my $s = DXProt::pc41($call, 2, $line); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; return (1, $self->msg('qth', $line)); } else { return (1, $self->msg('namee2', $call)); diff --git a/cmd/unset/here.pl b/cmd/unset/here.pl index 63a32162..c1c7b0f7 100644 --- a/cmd/unset/here.pl +++ b/cmd/unset/here.pl @@ -21,10 +21,14 @@ foreach $call (@args) { $dxchan->here(0); push @out, $self->msg('hereu', $call); if ($ref) { - DXProt::broadcast_all_ak1a(DXProt::pc24($ref), $DXProt::me) ; + my $s = DXProt::pc24($ref); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; $ref->here(0); } elsif ($ref = Route::Node::get($call)) { - DXProt::broadcast_all_ak1a(DXProt::pc24($ref), $DXProt::me) ; + my $s = DXProt::pc24($ref); + DXProt::eph_dup($s); + DXProt::broadcast_all_ak1a($s, $DXProt::me) ; $ref->here(0); } else { $ref = Route::Node::get($call); diff --git a/perl/DXProt.pm b/perl/DXProt.pm index dbe7faf8..a317fce2 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 $last10 %emph %pings %rcmds + $last_hour $last10 %eph %pings %rcmds %nodehops $baddx $badspotter $badnode $censorpc $allowzero $decode_dk0wcy $send_opernam @checklist); @@ -1072,7 +1072,7 @@ sub normal # REBROADCAST!!!! # - if (emph_dup($line)) { + if (eph_dup($line)) { dbg('chan', "PCPROT: Ephemeral dup, dropped"); } else { unless ($self->{isolate}) { @@ -1116,9 +1116,9 @@ sub process # every ten seconds if ($t - $last10 >= 10) { - # clean out emphemera + # clean out ephemera - emph_clean(); + eph_clean(); $last10 = $t; } @@ -1756,24 +1756,24 @@ sub route_pc21 broadcast_route($self, \&pc21, scalar @_, @_); } -sub emph_dup +sub eph_dup { my $s = shift; # chop the end off $s =~ s/\^H\d\d?\^?~?@//; - return 1 if exists $emph{$s}; - $emph{$s} = $main::systime; + return 1 if exists $eph{$s}; + $eph{$s} = $main::systime; return undef; } -sub emph_clean +sub eph_clean { my ($key, $val); - while (($key, $val) = each %emph) { + while (($key, $val) = each %eph) { if ($main::systime - $val > 90) { - delete $emph{$key}; + delete $eph{$key}; } } } -- 2.43.0