]> dxcluster.org Git - spider.git/commitdiff
fix (most of) the local config issues for aranea
authorminima <minima>
Sun, 20 Feb 2005 23:13:31 +0000 (23:13 +0000)
committerminima <minima>
Sun, 20 Feb 2005 23:13:31 +0000 (23:13 +0000)
perl/Aranea.pm
perl/Thingy/Bye.pm
perl/Thingy/Hello.pm

index 087eefc3d2f16c639f01384a77107648d95f5771..5ee04b1c1a43b654b0c7e1d1c0231ac6d7145fea 100644 (file)
@@ -59,7 +59,6 @@ sub new
        # add this node to the table, the values get filled in later
        my $pkg = shift;
        my $call = shift;
-       $main::routeroot->add($call, '5251', Route::here(1)) if $call ne $main::mycall;
        $self->{'sort'} = 'W';
        return $self;
 }
@@ -73,7 +72,7 @@ sub start
        # log it
        my $host = $self->{conn}->{peerhost} || "unknown";
        Log('Aranea', "$call connected from $host");
-       
+
        # remember type of connection
        $self->{consort} = $line;
        $self->{outbound} = $sort eq 'O';
index a29649664de727adb6d92c25266efdcd0af0f7f6..6d75b618e2832befe2cf4c58088964953266a890 100644 (file)
@@ -39,7 +39,7 @@ sub handle
 
        # fix the interface routing
        my $intcall = $thing->{user} || $thing->{origin};
-       if ($dxchan->{call} eq $thing->{origin}) {
+       if ($dxchan->{call} eq $thing->{origin} && !$thing->{user}) {
                RouteDB::delete_interface($intcall);
        } else {
                RouteDB::delete($intcall, $dxchan->{call});
@@ -48,7 +48,7 @@ sub handle
        # pc prot generation
        my @pc21;
        if (my $user = $thing->{user}) {
-               my $parent = Route::Node->get($thing->{origin});
+               my $parent = Route::Node::get($thing->{origin});
                my $uref = Route::get($user);
                if ($parent && $uref) {
                        if ($uref->isa('Route::Node')) {
index 5b63900699b7ad05d40806f30e1af76d8df12ab6..ed3e5b5cc68f7c5e607ab77b83c771657e0bd16c 100644 (file)
@@ -50,28 +50,34 @@ sub handle
        my $thing = shift;
        my $dxchan = shift;
        
+       my $origin = $thing->{origin};
+       my $node = $dxchan->{call};
+       
        my $nref;
+
        $thing->{pc19n} ||= [];
        
        # verify authenticity
-       if ($dxchan->{call} eq $thing->{origin}) {
+       if ($node eq $origin) {
 
                # for directly connected calls
                if ($verify_on_login) {
                        my $pp = $dxchan->user->passphrase;
                        unless ($pp) {
-                               dbglog('err', "Thingy::Hello::handle: verify on and $thing->{origin} has no passphrase");
+                               dbglog('err', "Thingy::Hello::handle: verify on and $origin has no passphrase");
                                $dxchan->disconnect;
                                return;
                        }
-                       my $auth = Verify->new("DXSp,$thing->{origin},$thing->{s},$thing->{v},$thing->{b}");
+                       my $auth = Verify->new("DXSp,$origin,$thing->{s},$thing->{v},$thing->{b}");
                        unless ($auth->verify($thing->{auth}, $dxchan->user->passphrase)) {
-                               dbglog('err', "Thingy::Hello::handle: verify on and $thing->{origin} failed auth check");
+                               dbglog('err', "Thingy::Hello::handle: verify on and $origin failed auth check");
                                $dxchan->disconnect;
                                return;
                        }
                }
                if ($dxchan->{state} ne 'normal') {
+                       $nref = $main::routeroot->add($origin, $thing->{v}, 1);
+                       push @{$thing->{pc19n}}, $nref if $nref;
                        $dxchan->start($dxchan->{conn}->{csort}, $dxchan->{conn}->{outbound} ? 'O' : 'A');
                        if ($dxchan->{outbound}) {
                                my $thing = Thingy::Hello->new();
@@ -82,17 +88,15 @@ sub handle
                                $thing->broadcast;
                        }
                }
-               my $origin = $thing->{origin};
-               $nref = $main::routeroot->add($origin, $thing->{v}, 1);
-               push @{$thing->{pc19n}}, $nref if $nref;
+               $nref = Route::Node::get($origin);
        } else {
                
                # for otherwise connected calls, that come in relayed from other nodes
                # note that we cannot do any connections at this point
-               $nref = Route::Node::get($thing->{origin});
+               $nref = Route::Node::get($origin);
                unless ($nref) {
                        my $v = $thing->{user} ? undef : $thing->{v};
-                       $nref = Route::Node->new($thing->{origin}, $v, 1);
+                       $nref = Route::Node->new($origin, $v, 1);
                        push @{$thing->{pc19n}}, $nref;
                }
        }
@@ -111,8 +115,8 @@ sub handle
                        }
                }
        }
-       RouteDB::update($thing->{origin}, $dxchan->{call}, $thing->{hopsaway});
-       RouteDB::update($thing->{user}, $dxchan->{call}, $thing->{hopsaway}) if $thing->{user};
+       RouteDB::update($origin, $node, $thing->{hopsaway});
+       RouteDB::update($thing->{user}, $node, $thing->{hopsaway}) if $thing->{user};
        
        delete $thing->{pc19n} unless @{$thing->{pc19n}};