X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=efe969b44a17222cbb32b5bd087db8a4329c83f0;hb=0f0ab4da54a368d833269bb816614b2adae97842;hp=64727b8a7d993b3e9ba480ac1871ae780dcaf922;hpb=bca5cd40374f12da5e0d46980e54bffc61fdc9c9;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 64727b8a..efe969b4 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -129,19 +129,20 @@ sub start # ping neighbour node stuff my $ping = $user->pingint; $ping = 5*60 unless defined $ping; - $self->pingint($ping); - $self->nopings($user->nopings || 2); - $self->pingtime([ ]); + $self->{pingint} = $ping; + $self->{nopings} = $user->nopings || 2; + $self->{pingtime} = [ ]; + $self->{pingave} = 0; # send initialisation string unless ($self->{outbound}) { $self->send(pc38()) if DXNode->get_all(); $self->send(pc18()); - $self->lastping($main::systime); + $self->{lastping} = $main::systime; } else { # remove from outstanding connects queue @main::outstanding_connects = grep {$_->{call} ne $call} @main::outstanding_connects; - $self->lastping($main::systime + $self->pingint / 2); + $self->{lastping} = $main::systime + $self->pingint / 2; } $self->state('init'); $self->pc50_t(time); @@ -190,7 +191,7 @@ sub normal # is it for me or one of mine? my $call = ($field[5] gt ' ') ? $field[5] : $field[2]; - if ($call eq $main::mycall || grep $_ eq $call, get_all_user_calls()) { + if ($call eq $main::mycall || grep $_ eq $call, DXChannel::get_all_user_calls()) { # yes, it is my $text = unpad($field[3]); @@ -656,7 +657,7 @@ sub normal } if ($pcno == 39) { # incoming disconnect - $self->disconnect(); + $self->disconnect(1); return; } @@ -721,18 +722,18 @@ sub normal my $t = tv_interval($r->{t}, [ gettimeofday ]); if ($dxchan->is_user) { my $s = sprintf "%.2f", $t; - my $ave = sprintf "%.2f", $tochan ? ($tochan->pingave || $t) : $t; + my $ave = sprintf "%.2f", $tochan ? ($tochan->{pingave} || $t) : $t; $dxchan->send($dxchan->msg('pingi', $field[2], $s, $ave)) } elsif ($dxchan->is_ak1a) { if ($tochan) { - $tochan->nopings(3); # pump up the timer - push @{$tochan->pingtime}, $t; - shift @{$tochan->pingtime} if @{$tochan->pingtime} > 6; + $tochan->{nopings} = 2; # pump up the timer + push @{$tochan->{pingtime}}, $t; + shift @{$tochan->{pingtime}} if @{$tochan->{pingtime}} > 6; my $st; - for (@{$tochan->pingtime}) { + for (@{$tochan->{pingtime}}) { $st += $_; } - $tochan->{pingave} = $st / @{$tochan->pingtime}; + $tochan->{pingave} = $st / @{$tochan->{pingtime}}; } } } @@ -780,13 +781,13 @@ sub process } # send a ping out on this channel - if ($dxchan->pingint && $t >= $dxchan->pingint + $dxchan->lastping) { - if ($dxchan->nopings <= 0) { + if ($dxchan->{pingint} && $t >= $dxchan->{pingint} + $dxchan->{lastping}) { + if ($dxchan->{nopings} <= 0) { $dxchan->disconnect; } else { addping($main::mycall, $dxchan->call); - $dxchan->nopings($dxchan->nopings - 1); - $dxchan->lastping($t); + $dxchan->{nopings} -= 1; + $dxchan->{lastping} = $t; } } } @@ -818,9 +819,10 @@ sub finish { my $self = shift; my $call = $self->call; + my $nopc39 = shift; my $ref = DXCluster->get_exact($call); - $self->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', "System Op"))); + $self->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', "System Op"))) unless $nopc39; # unbusy and stop and outgoing mail my $mref = DXMsg::get_busy($call);