X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy%2FHello.pm;h=7221d7898722fc58dd15a451b388211d5ada13fd;hb=7abfb64b58d106d8352eb365b63cec23669c4e0d;hp=52230aa16c2db0c727b00982685aca091a0a66d3;hpb=a05049f350f2acb4de3f76c7aed205417da688f6;p=spider.git diff --git a/perl/Thingy/Hello.pm b/perl/Thingy/Hello.pm index 52230aa1..7221d789 100644 --- a/perl/Thingy/Hello.pm +++ b/perl/Thingy/Hello.pm @@ -39,11 +39,11 @@ sub gen_Aranea if ($thing->{user}) { $thing->{h} ||= $dxchan->here; } else { - $thing->add_auth; $thing->{sw} ||= 'DXSp'; - $thing->{v} ||= $main::version; - $thing->{b} ||= $main::build; + $thing->{v} ||= $main::me->version; + $thing->{b} ||= $main::me->build; $thing->{h} ||= $main::me->here; + $thing->add_auth; } $thing->{Aranea} = Aranea::genmsg($thing, [qw(sw h v b s auth)]); @@ -62,6 +62,14 @@ sub handle my $nref; $thing->{pc19n} ||= []; + + my $v = $thing->{v}; + if ($v) { + $v = $DXProt::myprot_version + int ($v*100) if $v > 2 && $v < 3; + $v = $DXProt::myprot_version + 150 unless $v >= 5400; + $v =~ s/\.\d+$//; + $thing->{pcv} = $v; + } # verify authenticity if ($node eq $origin) { @@ -82,7 +90,7 @@ sub handle } } if ($dxchan->{state} ne 'normal') { - $nref = $main::routeroot->add($origin, $thing->{v}, $thing->{h}); + $nref = $main::routeroot->add($origin, $thing->{pcv}, $thing->{h}); push @{$thing->{pc19n}}, $nref if $nref; $dxchan->start($dxchan->{conn}->{csort}, $dxchan->{conn}->{outbound} ? 'O' : 'A'); if ($dxchan->{outbound}) { @@ -90,7 +98,7 @@ sub handle $thing->send($dxchan); # broadcast our configuration to the world - $thing = Thingy::Rt->new_lcf; + $thing = Thingy::Rt->new_cf; $thing->broadcast; } } @@ -102,7 +110,7 @@ sub handle # note that we cannot do any connections at this point $nref = Route::Node::get($origin); unless ($nref) { - my $v = $thing->{user} ? undef : $thing->{v}; + my $v = $thing->{user} ? undef : $thing->{pcv}; $nref = Route::Node->new($origin, $v, 1); push @{$thing->{pc19n}}, $nref; $nref->np(1); @@ -113,18 +121,20 @@ sub handle if (my $user = $thing->{user}) { my $ur = Route::get($user); unless ($ur) { - my $uref = DXUser->get_current($user) || Thingy::Hello::_upd_user_rec($user, $origin)->put; + my @ref; + my $uref = DXUser->get_current($user) || Thingy::Rt::_upd_user_rec($user, $origin)->put; if ($uref->is_node || $uref->is_aranea) { - $ur = $nref->add($user, $thing->{v}, $thing->{h}); - push @{$thing->{pc19n}}, $ur if $ur; + push @ref, $nref->add($user, $thing->{pcv} || 0, $thing->{h} || 0); + push @{$thing->{pc19n}}, @ref if @ref; + do $_->np(1) for @ref; } else { $thing->{pc16n} = $nref; - $thing->{pc16u} = [$ur = $nref->add_user($user, $thing->{h})]; + push @ref, $nref->add_user($user, $thing->{h} || 0); + $thing->{pc16u} = \@ref if @ref; } } - $ur->np(1); } else { - $nref->version($thing->{v}) unless $nref->version; + $nref->version($v) unless $nref->version; $nref->build($thing->{b}) unless $nref->build; $nref->sw($thing->{sw}) unless $nref->sw; $nref->here($thing->{h}) if exists $thing->{h};