$self->{isolate} = $user->{isolate};
$self->{consort} = $line; # save the connection type
$self->{here} = 1;
+ $self->{width} = 80;
# get the output filters
$self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'node_default', 0);
$self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'node_default', 0);
$self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'node_default', 0);
$self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'node_default', 0) ;
- $self->{routefilter} = Filter::read_in('route', $call, 0) || Filter::read_in('route', 'node_default', 0) ;
+ $self->{routefilter} = Filter::read_in('route', $call, 0) || Filter::read_in('route', 'node_default', 0) unless $self->{isolate} ;
# get the INPUT filters (these only pertain to Clusters)
$self->{inwwvfilter} = Filter::read_in('wwv', $call, 1) || Filter::read_in('wwv', 'node_default', 1);
$self->{inwcyfilter} = Filter::read_in('wcy', $call, 1) || Filter::read_in('wcy', 'node_default', 1);
$self->{inannfilter} = Filter::read_in('ann', $call, 1) || Filter::read_in('ann', 'node_default', 1);
- $self->{inroutefilter} = Filter::read_in('route', $call, 1) || Filter::read_in('route', 'node_default', 1);
+ $self->{inroutefilter} = Filter::read_in('route', $call, 1) || Filter::read_in('route', 'node_default', 1) unless $self->{isolate};
# set unbuffered and no echo
$self->send_now('B',"0");
$self->{pingint} = $ping;
$self->{nopings} = $user->nopings || 2;
$self->{pingtime} = [ ];
- $self->{pingave} = 0;
+ $self->{pingave} = 999;
+ $self->{lastping} = $main::systime;
# send initialisation string
unless ($self->{outbound}) {
$self->send(pc18());
- $self->{lastping} = $main::systime;
- } else {
- $self->{lastping} = $main::systime + ($self->pingint / 2);
}
+
$self->state('init');
$self->{pc50_t} = $main::systime;
$conf = $conf eq '*';
- my $r = Route::User::get($call);
+ # reject this if we think it is a node already
+ my $r = Route::Node::get($call);
+ my $u = DXUser->get_current($call) unless $r;
+ if ($r || ($u && $u->is_node)) {
+ dbg("PCPROT: $call is a node") if isdbg('chanerr');
+ next;
+ }
+
+ $r = Route::User::get($call);
my $flags = Route::here($here)|Route::conf($conf);
if ($r) {
dbg("PCPROT: PC17 from $self->{call} trying to alter locally connected $ncall, ignored!") if isdbg('chanerr');
return;
}
- my $parent = Route::Node::get($ncall);
- unless ($parent) {
- dbg("PCPROT: Route::Node $ncall not in config") if isdbg('chanerr');
- return;
- }
+
my $uref = Route::User::get($ucall);
unless ($uref) {
dbg("PCPROT: Route::User $ucall not in config") if isdbg('chanerr');
return;
}
-
+ my $parent = Route::Node::get($ncall);
+ unless ($parent) {
+ dbg("PCPROT: Route::Node $ncall not in config") if isdbg('chanerr');
+ return;
+ }
# input filter if required
return unless $self->in_filter_route($parent);
# first clear out any nodes on this dxchannel
my $parent = Route::Node::get($self->{call});
my @rout = $parent->del_nodes;
- $self->route_pc21(@rout, $parent);
+ $self->route_pc21(@rout, $parent) if @rout;
$self->send_local_config();
$self->send(pc20());
return; # we don't pass these on
$self->send_local_config();
$self->send(pc22());
$self->state('normal');
+ $self->{lastping} = 0;
return;
}
if ($pcno == 22) {
$self->state('normal');
+ $self->{lastping} = 0;
return;
}
$dxchan->send($dxchan->msg('pingi', $from, $s, $ave))
} elsif ($dxchan->is_node) {
if ($tochan) {
- $tochan->{nopings} = $tochan->user->nopings || 2; # pump up the timer
+ my $nopings = $tochan->user->nopings || 2;
push @{$tochan->{pingtime}}, $t;
shift @{$tochan->{pingtime}} if @{$tochan->{pingtime}} > 6;
- my $st;
- for (@{$tochan->{pingtime}}) {
- $st += $_;
+
+ # cope with a missed ping, this means you must set the pingint large enough
+ if ($t > $tochan->{pingint} && $t < 2 * $tochan->{pingint} ) {
+ $t -= $tochan->{pingint};
}
- $tochan->{pingave} = $st / @{$tochan->{pingtime}};
+
+ # calc smoothed RTT a la TCP
+ if (@{$tochan->{pingtime}} == 1) {
+ $tochan->{pingave} = $t;
+ } else {
+ $tochan->{pingave} = $tochan->{pingave} + (($t - $tochan->{pingave}) / 6);
+ }
+# my $st;
+# for (@{$tochan->{pingtime}}) {
+# $st += $_;
+# }
+# $tochan->{pingave} = $st / @{$tochan->{pingtime}};
+ $tochan->{nopings} = $nopings; # pump up the timer
}
}
}
foreach $dxchan (@dxchan) {
next if $dxchan == $me;
next if $dxchan == $self && $self->is_node;
- my $routeit;
- my ($filter, $hops);
-
- $dxchan->announce($line, $self->{isolate}, $to, $target, $text, @_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq)
+ $dxchan->announce($line, $self->{isolate}, $to, $target, $text, @_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
}
}
my $isolate = shift;
my $to = shift;
my $target = shift;
+ my $text = shift;
my ($filter, $hops);
if ($self->{annfilter}) {
# create a list of all the nodes that are not connected to this connection
# and are not themselves isolated, this to make sure that isolated nodes
# don't appear outside of this node
- my @dxchan = grep { $_->call ne $main::mycall && $_->call ne $self->{call} } DXChannel::get_all_nodes();
+ my @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} } DXChannel::get_all_nodes();
@localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan;
my @intcalls = map { $_->nodes } @localnodes if @localnodes;
my $ref = Route::Node::get($self->{call});
my $pc39flag = shift;
my $call = $self->call;
+ return if $self->{disconnecting}++;
+
unless ($pc39flag && $pc39flag == 1) {
$self->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', "System Op")));
}
for (; @_ && $no; $no--) {
my $r = shift;
- if ($self->{routefilter}) {
+ if (!$self->{isolate} && $self->{routefilter}) {
$filter = undef;
if ($r) {
($filter, $hops) = $self->{routefilter}->it($self->{call}, $self->{dxcc}, $self->{itu}, $self->{cq}, $r->call, $r->dxcc, $r->itu, $r->cq);
dbg("was sent a null value") if isdbg('chanerr');
}
} else {
- push @rin, $r;
+ push @rin, $r unless $self->{isolate} && $r->call ne $main::mycall;
}
}
if (@rin) {
my $dxchan;
my $line;
- foreach $dxchan (@dxchan) {
- next if $dxchan == $self;
- next if $dxchan == $me;
- if ($dxchan->{routefilter}) {
+ unless ($self->{isolate}) {
+ foreach $dxchan (@dxchan) {
+ next if $dxchan == $self;
+ next if $dxchan == $me;
$dxchan->send_route($generate, @_);
- } else {
- $dxchan->send_route($generate, @_) unless $self->{isolate} || $dxchan->{isolate};
}
}
}
sub eph_dup
{
my $s = shift;
+ my $r;
# chop the end off
$s =~ s/\^H\d\d?\^?\~?$//;
- return 1 if exists $eph{$s};
+ $r = 1 if exists $eph{$s}; # pump up the dup if it keeps circulating
$eph{$s} = $main::systime;
- return undef;
+ return $r;
}
sub eph_del_regex
my ($key, $val);
while (($key, $val) = each %eph) {
- if ($main::systime - $val > 90) {
+ if ($main::systime - $val > 180) {
delete $eph{$key};
}
}