X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProtHandle.pm;h=99eb71d27464c27299708a1a2590390ecbd84a01;hb=90b87fdbe4bb4f904e89939640aa7764a69e5616;hp=d739d65d72a8cef9c4ac401145f619a4fe12230f;hpb=d3641e4f287c5268bafda521f3bd9cd0080e6165;p=spider.git diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index d739d65d..99eb71d2 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -598,24 +598,29 @@ sub handle_18 my $parent = Route::Node::get($self->{call}); # record the type and version offered - if ($_[1] =~ /DXSpider Version: (\d+\.\d+) Build: (\d+(?:\.\d+)?)/) { + if ($_[1] =~ /DXSpider Version: (\d+\.\d+)/) { $self->{version} = 53 + $1; $self->user->version(53 + $1); $parent->version(0 + $1); - $self->{build} = 0 + $2; - $self->user->build(0 + $2); - $parent->build(0 + $2); + dbg("DXSpider version $1"); + my ($build) = $_[1] =~ /Build: (\d+(?:\.\d+)?)/; + $self->{build} = 0 + $build; + $self->user->build(0 + $build); + $parent->build(0 + $build); + dbg("DXSpider build $build"); unless ($self->is_spider) { + dbg("Change U " . $self->user->sort . " C $self->{sort} -> S"); $self->user->sort('S'); $self->user->put; $self->sort('S'); } - $self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml/; +# $self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml/; if ($_[1] =~ /\bpc9x/) { $self->{do_pc9x} = 1; dbg("Do px9x set on $self->{call}"); } } else { + dbg("Unknown software"); $self->version(50.0); $self->version($_[2] / 100) if $_[2] && $_[2] =~ /^\d+$/; $self->user->version($self->version); @@ -787,16 +792,14 @@ sub handle_20 my $origin = shift; if ($self->{do_pc9x} && $self->{state} ne 'init92') { - dbg("PCPROT: disconnecting because login call not sent in any pc92") if isdbg('chanerr'); - $self->send("**** You logged in with $self->{call} but that is NOT your \$mycall"); - $self->disconnect; - return; + $self->send("Reseting to oldstyle routing because login call not sent in any pc92"); + $self->{do_pc9x} = 0; } $self->send_local_config; $self->send(pc22()); $self->state('normal'); $self->{lastping} = 0; - $self->route_pc92a($main::mycall, $line, $main::routeroot, Route::Node::get($self->{call})); + $self->route_pc92a($main::mycall, undef, $main::routeroot, Route::Node::get($self->{call})); } # delete a cluster from the list @@ -878,10 +881,8 @@ sub handle_22 if ($self->{do_pc9x}) { if ($self->{state} ne 'init92') { - dbg("PCPROT: disconnecting because login call not sent in any pc92") if isdbg('chanerr'); - $self->send("**** You logged in with $self->{call} but that is NOT your \$mycall"); - $self->disconnect; - return; + $self->send("Reseting to oldstyle routing because login call not sent in any pc92"); + $self->{do_pc9x} = 0; } } $self->{lastping} = 0; @@ -1555,39 +1556,49 @@ sub handle_92 # here is where all the routes are created and destroyed my @ent = map {[ _decode_pc92_call($_) ]} grep {$_ && /^[0-7]/} @_[4 .. $#_]; + if (@ent) { # look at the first one which will always be a node of some sort - # and update any information that needs to be done. + # except in the case of 'A' or 'D' in which the $pcall is used + # otherwise use the node call and update any information + # that needs to be done. my ($call, $is_node, $is_extnode, $here, $version, $build) = @{$ent[0]}; - if ($call && $is_node) { - if ($call eq $main::mycall) { - dbg("PCPROT: $call looped back onto $main::mycall, ignored") if isdbg('chanerr'); - return; - } - if ($is_extnode) { - # this is only accepted from my "self" - if (DXChannel::get($call) && $call ne $self->{call}) { - dbg("PCPROT: locally connected node config for $call from other another node $self->{call}, ignored") if isdbg('chanerr'); + if (($sort eq 'A' || $sort eq 'D') && !$is_node) { + # parent is already set correctly + # this is to allow shortcuts for A and D records + # not repeating the origin call to no real purpose + ; + } else { + if ($call && $is_node) { + if ($call eq $main::mycall) { + dbg("PCPROT: $call looped back onto $main::mycall, ignored") if isdbg('chanerr'); return; } - # 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) { + # this is only accepted from my "self" + if (DXChannel::get($call) && $call ne $self->{call}) { + dbg("PCPROT: locally connected node config for $call from other another node $self->{call}, ignored") if isdbg('chanerr'); + return; + } + # 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; + } + $parent = check_pc9x_t($call, $t, 92) || return; + $parent->via_pc92(1); } - $parent = check_pc9x_t($call, $t, 92) || return; - $parent->via_pc92(1); + } else { + dbg("PCPROT: must be mycall or external node as first entry, ignored") if isdbg('chanerr'); + return; } - } else { - dbg("PCPROT: must be mycall or external node as first entry, ignored") if isdbg('chanerr'); - return; + $parent->here(Route::here($here)); + $parent->version($version) if $version && $version > $parent->version; + $parent->build($build) if $build && $build > $parent->build; + shift @ent; } - $parent->here(Route::here($here)); - $parent->version($version) if $version && $version > $parent->version; - $parent->build($build) if $build && $build > $parent->build; - shift @ent; } # do a pass through removing any references to either locally connected nodes or mycall @@ -1650,6 +1661,9 @@ sub handle_92 foreach my $r (@$dusers) { push @rdel,_del_thingy($parent, [$r, 0]); } + + # remember this last PC92C for rebroadcast on demand + $parent->last_PC92C($line); } else { dbg("PCPROT: unknown action '$sort', ignored") if isdbg('chanerr'); return;