From: minima Date: Wed, 7 Jul 2004 16:44:12 +0000 (+0000) Subject: now working to 1st order OK with two nodes. X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=98b0984d0ab735a1ae2d96e36728c7e334cf5fd7;p=spider.git now working to 1st order OK with two nodes. --- diff --git a/cmd/show/route.pl b/cmd/show/route.pl index 4ebebde3..d10cf17f 100644 --- a/cmd/show/route.pl +++ b/cmd/show/route.pl @@ -16,7 +16,7 @@ my $l; foreach $l (@list) { my $ref = Route::get($l); if ($ref) { - my $parents = $ref->isa('Route::Node') ? $l : join(',', $ref->parents); + my $parents = $ref->isa('Route::Node') ? $l : join(',', $ref->nodes); push @out, $self->msg('route', $l, $parents, join(',', map {$_->call} $ref->alldxchan)); } else { push @out, $self->msg('e7', $l); diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 0b788ba7..ba958cfa 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -1427,31 +1427,35 @@ sub handle_59 my $line = shift; my $origin = shift; - return unless eph_dup($line); - my ($sort, $hextime, $ncall) = @_[1,2,3]; if ($ncall eq $main::mycall) { dbg("PCPROT: ignoring PC59 for me") if isdbg('chan'); return; } - # mark myself as NewRoute if I get a PC59 - $self->{newroute} = 1 if $ncall eq $self->{call}; - # do this once for filtering with a throwaway routing entry if a new node my $fnode = Route::Node::get($ncall) || Route::new($ncall); return unless $self->in_filter_route($fnode); + return if eph_dup($line); + + # mark myself as NewRoute if I get a PC59 + $self->{newroute} = 1 if $ncall eq $self->{call}; + # now do it properly for actions my $node = Route::Node::get($ncall) || Route::Node->new($ncall); $node->newroute(1); # find each of the entries (or create new ones) my @refs; - for my $ent (@_[4..-1]) { + for my $ent (@_[4..$#_]) { + next if $ent =~ /^H\d+$/; + my ($esort, $ehere, $ecall) = unpack "A A A*", $ent; my $ref; + next unless $esort && defined $ehere && $ecall; + # create user, if required my $user = DXUser->get_current($ecall); unless ($user) { @@ -1508,6 +1512,7 @@ sub handle_59 if ($sort eq 'D') { for my $ref (@refs) { next if $ref->call eq $ncall; + next if $ref->call eq $main::mycall; if ($ref->isa('Route::Node')) { push @delnode, $node->unlink_node($ref, $self); } elsif ($ref->isa('Route::User')) { @@ -1522,6 +1527,7 @@ sub handle_59 if ($sort eq 'A') { for my $ref (@refs) { next if $ref->call eq $ncall; + next if $ref->call eq $main::mycall; if ($ref->isa('Route::Node')) { my $new = $node->link_node($ref, $self); push @addnode, $new if $new; @@ -1542,6 +1548,8 @@ sub handle_59 my @au; for my $r (map {Route::Node::get($_)} $node->nodes) { next unless $r; + next if $r->call eq $ncall; + next if $r->call eq $main::mycall; push @dn, $r unless grep $_->call eq $r->call, @refs; } for my $r (map {Route::User::get($_)} $node->users) { @@ -1550,6 +1558,8 @@ sub handle_59 } for my $r (@refs) { next unless $r; + next if $r->call eq $ncall; + next if $r->call eq $main::mycall; if ($r->isa('Route::Node')) { push @an, $r unless grep $r->call eq $_, $node->nodes; } elsif ($r->isa('Route::User')) { @@ -1999,7 +2009,9 @@ sub send_local_config if ($self->{newroute}) { my @nodes = $self->{isolate} ? ($main::routeroot) : grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} } DXChannel::get_all_nodes(); my @users = DXChannel::get_all_users(); - $self->send_route($main::mycall, \&pc59, @nodes+@users+4, 'C', 0, $main::mycall, (grep { Route::get($_) } $main::routeroot, @nodes, @users)); + @localnodes = map { Route::Node::get($_->{call}) } @nodes; + my @localusers = map { Route::User::get($_->{call}) } @users; + $self->send_route($main::mycall, \&pc59, @nodes+@users+4, 'C', 0, $main::mycall, $main::routeroot, @localnodes, @localusers); } else { # send our nodes if ($self->{isolate}) { @@ -2382,8 +2394,12 @@ sub broadcast_route next if $dxchan == $main::me; next unless $dxchan->isa('DXProt'); next if ($generate == \&pc16 || $generate==\&pc17) && !$dxchan->user->wantsendpc16; - next if ($generate == \&pc19 || $generate==\&pc21) && !$dxchan->user->wantsendpc19; - next if ($generate == \&pc59) && !$dxchan->{newroute}; + if ($dxchan->{newroute}) { + next if ($generate == \&pc19 || $generate==\&pc21); + } else { + next if ($generate == \&pc19 || $generate==\&pc21) && !$dxchan->user->wantroutepc19; + next if ($generate == \&pc59); + } $dxchan->send_route($origin, $generate, @_); } diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index dc4257a8..68405f8f 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -372,7 +372,7 @@ sub hexstamp $hexlastlet = chr(ord($hexlastlet) + 1); } while ($hexlastlet eq '^'); } - return sprintf "%c%08X", $hexlastlet, $hexlasttime; + return sprintf "%s%08X", $hexlastlet, $hexlasttime; } sub pc58