X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2FDXProt.pm;h=f68edc275bde45c1afe95bb67346136bcda02d76;hb=70908cf7f69eb4fc0caf5d735382bc2c1c1466a3;hp=59cdcf96c7272b5034007869e722e00df64ea830;hpb=7ccae7dc99f806c3a0b128a0cf26cf8e489048fb;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 59cdcf96..f68edc27 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -196,7 +196,9 @@ sub init $main::me->{priv} = 9; $main::me->{metric} = 0; $main::me->{pingave} = 0; - + $main::me->{version} = $main::version; + $main::me->{build} = $main::build; + # $Route::Node::me->adddxchan($main::me); } @@ -739,6 +741,23 @@ sub normal if ($pcno == 18) { # link request $self->state('init'); + # record the type and version offered + if ($field[1] =~ /DXSpider Version: (\d+\.\d+) Build: (\d+\.\d+)/) { + $self->version(53 + $1); + $self->user->version(53 + $1); + $self->build(0 + $2); + $self->user->build(0 + $2); + unless ($self->is_spider) { + $self->user->sort('S'); + $self->user->put; + $self->sort('S'); + } + } else { + $self->version(50.0); + $self->version($field[2] / 100) if $field[2] && $field[2] =~ /^\d+$/; + $self->user->version($self->version); + } + # first clear out any nodes on this dxchannel my $parent = Route::Node::get($self->{call}); my @rout = $parent->del_nodes; @@ -1168,11 +1187,6 @@ sub normal } else { $tochan->{pingave} = $tochan->{pingave} + (($t - $tochan->{pingave}) / 6); } -# my $st; -# for (@{$tochan->{pingtime}}) { -# $st += $_; -# } -# $tochan->{pingave} = $st / @{$tochan->{pingtime}}; $tochan->{nopings} = $nopings; # pump up the timer } } @@ -1238,6 +1252,24 @@ sub normal return; } if ($pcno == 90) { # new style PC16,17,19,21 + my $node = $field[1]; + + # mark this node as wanting PC90s + my $parent = Route::Node::get($node); + if ($parent) { + my $t = hex $field[2]; + my $last = $parent->lastpc90 || 0; + if ($last < $t) { + $parent->pc90(1); + $parent->lastpc90($t); + my ($updsort, $n) = unpack "AA*", $field[3]; + for (my $i = 4; $i < $#field; $i++) { + my ($sort, $flag, $node, $ping) = $field[$i] =~ m{(\w)(\d)([-\w+])(,\d+)?}; + $ping /= 10 if (defined $ping); + } + } + } + return; } } @@ -1282,8 +1314,8 @@ sub process next if $dxchan == $main::me; # send the pc50 or PC90 - if ($pc50s && $dxchan->is_spider) { -# $dxchan->send_route(\&pc90, 1, $main::me, 'T', @dxchan); + if ($pc50s && $dxchan->user->wantpc90) { + $dxchan->send_route(\&pc90, 1, $main::me, 'T', @dxchan); } else { $dxchan->send($pc50s) if $pc50s; } @@ -1577,6 +1609,7 @@ sub send_local_config unshift @localnodes, $main::routeroot; } + send_route($self, \&pc19, scalar(@localnodes)+scalar(@remotenodes), @localnodes, @remotenodes); # get all the users connected on the above nodes and send them out @@ -1587,7 +1620,7 @@ sub send_local_config dbg("sent a null value") if isdbg('chanerr'); } } -# $self->send_route(\&pc90, 1, $main::me, 'T', DXChannel::get_all()); + $self->send_route(\&pc90, 1, $main::me, 'T', DXChannel::get_all()) if $self->user->wantpc90; } #