3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00

lagchecker: use immediate elasped duration instead of average when no pong has been received yet

This commit is contained in:
Pragmatic Software 2011-12-12 00:31:31 +00:00
parent 44bef4bdb3
commit e10d81b769
2 changed files with 2 additions and 9 deletions

View File

@ -102,14 +102,7 @@ sub lagging {
if(defined $self->{pong_received} and $self->{pong_received} == 0) {
# a ping has been sent (pong_received is not undef) and no pong has been received yet
my $elapsed = tv_interval($self->{ping_send_time});
my $lag_total = $elapsed;
my $len = @{ $self->{lag_history} };
foreach my $entry (@{ $self->{lag_history} }) {
my ($send_time, $lag_result) = @{ $entry };
$lag_total += $lag_result;
}
my $average = $lag_total / ($len + 1);
return $average >= $self->{LAG_THRESHOLD};
return $elapsed >= $self->{LAG_THRESHOLD};
}
return 0 if not defined $self->{lag_average};

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 329,
BUILD_REVISION => 330,
BUILD_DATE => "2011-12-11",
};