| View previous topic :: View next topic |
| Author |
Message |
crazyboy
Joined: 06 Sep 2008 Posts: 1
|
Posted: Sep 07, 2008 11:37 am Post subject: my download is limited |
|
|
| After i installed the script my download was limited by the script.. when i pus a file to download without script i download with 11 mb/sec but when i upload a file with the script my download is limited at 600 kb/sec |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2109 Location: UFO Lab
|
Posted: Sep 08, 2008 6:50 am Post subject: |
|
|
| Check your CPU/RAM usage while uploading. |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2109 Location: UFO Lab
|
Posted: Sep 08, 2008 7:10 am Post subject: |
|
|
Also try this quick hack: in upload.cgi replace subfunction "sub hook {...}"
with new one:
| Code: | sub hook
{
my ($fname, $buffer) = @_;
my $buff_size = length($buffer);
$current_bytes+=$buff_size;
$time = time;
$time_spent = $time - $time_start;
my ($changed,$nf);
if($fname_old ne $fname || $buff_old<$buff_size)
{
$files_uploaded++ if $fname_old;
$fname_old=$fname;
my $fsize = $current_bytes-$total_old;
$total_old=$current_bytes;
$nf = "file_uploaded:$files_uploaded:$fsize\n";
}
$buff_old = $buff_size;
if($time>$old_time)
{
$speed = int( ($current_bytes-$old_size)/($time-$old_time) );
$old_size = $current_bytes;
$old_time = $time;
$changed=1;
}
if($changed || $nf)
{
open F,"$temp_dir/flength";
my @arr = <F>;
close F;
$arr[0] = "$ENV{CONTENT_LENGTH}:$current_bytes:$time_spent:$speed:$files_uploaded\n";
push(@arr, $nf) if $nf;
open F,"+< $temp_dir/flength" or die"Can't open flength";
flock F, LOCK_EX or die"Can't lock flength";
truncate F, 0;
print F @arr;
close F;
}
} |
|
|
| Back to top |
|
 |
|