use Route;
use Route::Node;
use Script;
+use Investigate;
use strict;
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 %pc19list $chatdupeage
+ $pingint $obscount %pc19list $chatdupeage $investigation_int
%nodehops $baddx $badspotter $badnode $censorpc $rspfcheck
$allowzero $decode_dk0wcy $send_opernam @checklist);
$pingint = 5*60;
$obscount = 2;
$chatdupeage = 20 * 60 * 60;
+$investigation_int = 7*86400; # time between checks to see if we can see this node
@checklist =
(
next if length $call < 3; # min 3 letter callsigns
next if $call eq $main::mycall;
- # do we believe this call?
- unless ($call eq $self->{call} || $self->is_believed($call)) {
- dbg("PCPROT: We don't believe $call on $self->{call}");
- next;
- }
-
- eph_del_regex("^PC(?:21\\^$call|17\\^[^\\^]+\\^$call)");
-
# add this station to the user database, if required (don't remove SSID from nodes)
my $user = DXUser->get_current($call);
if (!$user) {
$user->node($call);
}
$user->wantroutepc19(1) unless defined $user->wantroutepc19;
+ $user->lastin($main::systime) unless DXChannel->get($call);
+ $user->put;
+
+ # do we believe this call?
+ unless ($call eq $self->{call} || $self->is_believed($call)) {
+ my $pt = $user->lastping || 0;
+ if ($pt+$investigation_int < $main::systime && !Investigate::get($call)) {
+ my $iref = Investigate->new($call);
+ $iref->version($ver);
+ $iref->here($here);
+ }
+ dbg("PCPROT: We don't believe $call on $self->{call}");
+ next;
+ }
+ eph_del_regex("^PC(?:21\\^$call|17\\^[^\\^]+\\^$call)");
+
my $r = Route::Node::get($call) || Route::Node->new($call);
$r->here($here);
$r->conf($conf);
# unbusy and stop and outgoing mail (ie if somehow we receive another PC19 without a disconnect)
my $mref = DXMsg::get_busy($call);
$mref->stop_msg($call) if $mref;
-
- $user->lastin($main::systime) unless DXChannel->get($call);
- $user->put;
}
# route out new nodes to legacy nodes
} else {
$tochan->{pingave} = $tochan->{pingave} + (($t - $tochan->{pingave}) / 6);
}
+ my $rref = Route::Node::get($tochan->{call});
+ $rref->pingtime($tochan->{pingave}) if $rref;
$tochan->{nopings} = $nopings; # pump up the timer
+ } elsif (my $rref = Route::Node::get($r->{call})) {
+ if (defined $rref->pingtime) {
+ $rref->pingtime($rref->pingtime + (($t - $rref->pingtime) / 6));
+ } else {
+ $rref->pingtime($t);
+ }
}
}
}
route(undef, $to, pc51($to, $main::mycall, 1));
push @$ref, $r;
$pings{$to} = $ref;
+ my $u = DXUser->get_current($to);
+ $u->lastping($main::systime) if $u;
}
sub process_rcmd
--- /dev/null
+#
+# Investigate whether an external node is accessible
+#
+# If it is, make it believable otherwise mark as not
+# to be believed.
+#
+# It is possible to store up state for a node to be
+# investigated, so that if it is accessible, its details
+# will be passed on to whomsoever might be interested.
+#
+# Copyright (c) 2004 Dirk Koopman, G1TLH
+#
+# $Id$
+#
+
+use strict;
+
+package Investigate;
+
+use DXDebug;
+use DXUtil;
+
+
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+use vars qw (%list %valid);
+
+%list = (); # the list of outstanding investigations
+%valid = ( # valid fields
+ call => '0,Callsign',
+ start => '0,Started at,atime',
+ version => '0,Node Version',
+ build => '0,Node Build',
+ here => '0,Here?,yesno',
+ conf => '0,In Conf?,yesno',
+ );
+
+
+sub new
+{
+ my $pkg = shift;
+ my $call = shift;
+ my $self = $list{$call} || bless { call=>$call, start=>$main::systime }, ref($pkg) || $pkg;
+ return $self;
+}
+
+sub get
+{
+ return $list{$_[0]};
+}
+
+sub AUTOLOAD
+{
+ no strict;
+ my $name = $AUTOLOAD;
+ return if $name =~ /::DESTROY$/;
+ $name =~ s/^.*:://o;
+
+ confess "Non-existant field '$AUTOLOAD'" if !$valid{$name};
+
+ # this clever line of code creates a subroutine which takes over from autoload
+ # from OO Perl - Conway
+ *$AUTOLOAD = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}};
+ goto &$AUTOLOAD;
+}
+1;