From fd36669693e8cfd4f474bea26283256087c7ad26 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 19 Apr 2005 23:23:17 +0000 Subject: Only send javascript update messages when the percentage changes. This avoids sending the clients firefox utilization to 100% --- usr/local/www/guiconfig.inc | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index d249d9d..4f0a77a 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -543,19 +543,13 @@ function read_body($ch, $string) { $downloaded += intval($length); $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); $downloadProgress = 100 - $downloadProgress; - /* - $a = $file_size; - $b = $downloaded; - $c = $downloadProgress; - $text = " Download Status\\n"; - $text .= "---------------------------------\\n"; - $text .= " File size : {$a}\\n"; - $text .= " Downloaded : {$b}\\n"; - $text .= " Percent : {$c}%\\n"; - $text .= "---------------------------------\\n"; + /* + lastseen is used to prevent from spamming firefox with hundreds of + unnecessary javascript update messages which sends the clients + firefox utilization to 100% */ -// $counter++; -// if($counter > 150) { + $lastseen = "-1"; + if($lastseen <> $downloadProgress) { if($sendto == "status") { $tostatus = $static_status . $downloadProgress . "%"; update_status($tostatus); @@ -564,8 +558,8 @@ function read_body($ch, $string) { update_output_window($tooutput); } update_progress_bar($downloadProgress); -// $counter = 0; -// } + $lastseen = $downloadProgress; + } fwrite($fout, $string); return $length; } -- cgit v1.1