$eph_pc15_restime $pc9x_past_age $pc9x_future_age
);
-$pc9x_past_age = 15*60; # maximum age in the past of a px9x
+$pc9x_past_age = 62*60; # maximum age in the past of a px9x (a config record might be the only
+ # thing a node might send - once an hour)
$pc9x_future_age = 5*60; # maximum age in the future ditto
# incoming talk commands
push @rout, @ans if $h && @ans;
}
- # send info to all logged in thingies
- $self->tell_login('loginu', "$ncall: $call") if DXUser->get_current($ncall)->is_local_node;
- $self->tell_buddies('loginb', $call, $ncall);
-
# add this station to the user database, if required
-# $call =~ s/-\d+$//o; # remove ssid for users
- my $user = DXUser->get_current($call);
- $user = DXUser->new($call) if !$user;
+ my $user = DXUser->get_current($ncall);
+ $user = DXUser->new($call) unless $user;
$user->homenode($parent->call) if !$user->homenode;
$user->node($parent->call);
$user->lastin($main::systime) unless DXChannel::get($call);
$user->put;
+
+ # send info to all logged in thingies
+ $self->tell_login('loginu', "$ncall: $call") if $user->is_local_node;
+ $self->tell_buddies('loginb', $call, $ncall);
}
if (@rout) {
$self->route_pc16($origin, $line, $parent, @rout) if @rout;
$parent->del_user($uref);
# send info to all logged in thingies
- $self->tell_login('logoutu', "$ncall: $ucall") if DXUser->get_current($ncall)->is_local_node;
+ my $user = DXUser->get_current($ncall);
+ $self->tell_login('logoutu', "$ncall: $ucall") if $user && $user->is_local_node;
$self->tell_buddies('logoutb', $ucall, $ncall);
if (eph_dup($line)) {
# $self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml/;
if ($_[1] =~ /\bpc9x/) {
if ($self->{isolate}) {
- dbg("pc9x recognised, but is isolated, using old protocol");
+ dbg("pc9x recognised, but $self->{call} is isolated, using old protocol");
+ } elsif (!$self->user->wantpc9x) {
+ dbg("pc9x explicitly switched off on $self->{call}, using old protocol");
} else {
$self->{do_pc9x} = 1;
dbg("Do px9x set on $self->{call}");
if ($parent->call ne $main::mycall) {
my $lastid = $parent->lastid->{$pc} || 0;
if ($t < $lastid) {
- if ($lastid-86400+$t > $pc9x_past_age) {
- dbg("PCPROT: dup id on $t <= $lastid (midnight rollover), ignored") if isdbg('chanerr');
+ if ($t+86400-$lastid > $pc9x_past_age) {
+ dbg("PCPROT: dup id on $t <= $lastid, ignored") if isdbg('chanerr');
return;
}
- }
- if ($lastid >= $t) {
- dbg("PCPROT: dup id on $call $lastid >= $t, ignored") if isdbg('chanerr');
+ } elsif ($t == $lastid) {
+ dbg("PCPROT: dup id on $t == $lastid, ignored") if isdbg('chanerr');
return;
+ } else {
+ # $t > $lastid, check that the timestamp offered isn't too far away from 'now'
+ if ($t+$main::systime_daystart-$main::systime > $pc9x_future_age ) {
+ dbg("PCPROT: id $t too far in the future, ignored") if isdbg('chanerr');
+ return;
+ }
}
}
} elsif ($create) {
}
if ($pcall eq $self->{call} && $self->{state} eq 'init') {
- $self->state('init92');
- $self->{do_pc9x} = 1;
- dbg("Do pc9x set on $pcall");
+ if ($self->{isolate}) {
+ dbg("PC9x received, but $pcall is isolated, ignored");
+ return;
+ } elsif (!$self->user->wantpc9x) {
+ dbg("PC9x explicitly switched off on $pcall, ignored");
+ return;
+ } else {
+ $self->state('init92');
+ $self->{do_pc9x} = 1;
+ dbg("Do pc9x set on $pcall");
+ }
}
unless ($self->{do_pc9x}) {
dbg("PCPROT: PC9x come in from non-PC9x node, ignored") if isdbg('chanerr');
# reparent to external node (note that we must have received a 'C' or 'A' record
# from the true parent node for this external before we get one for the this node
unless ($parent = Route::Node::get($call)) {
- dbg("PCPROT: no previous C or A for this external node received, ignored") if isdbg('chanerr');
- return;
+ if ($is_extnode && $oparent) {
+ @radd = _add_thingy($oparent, $ent[0]);
+ $parent = $radd[0];
+ } else {
+ dbg("PCPROT: no previous C or A for this external node received, ignored") if isdbg('chanerr');
+ return;
+ }
}
$parent = check_pc9x_t($call, $t, 92) || return;
$parent->via_pc92(1);
# we only reset obscounts on config records
$oparent->reset_obs;
+ $oparent->PC92C_dxchan($self->{call}) unless $self->{call} eq $oparent->call;
dbg("ROUTE: reset obscount on $pcall now " . $oparent->obscount) if isdbg('obscount');
if ($oparent != $parent) {
$parent->reset_obs;
+ $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call;
dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount');
}
dbg("PCPROT: invalid callsign string '$_[1]', ignored") if isdbg('chanerr');
return;
}
+
+ unless ($self->{do_pc9x}) {
+ dbg("PCPROT: PC9x come in from non-PC9x node, ignored") if isdbg('chanerr');
+ return;
+ }
+
my $t = $_[2];
my $parent = check_pc9x_t($pcall, $t, 93, 1) || return;