XFileSharing Free - my download is limited

Message
Author
crazyboy
Posts: 1
Joined: Sep 06, 2008 9:25 pm

my download is limited

#1 Postby crazyboy » Sep 07, 2008 11:37 am

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

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Sep 08, 2008 6:50 am

Check your CPU/RAM usage while uploading.

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#3 Postby PilgrimX182 » Sep 08, 2008 7:10 am

Also try this quick hack: in upload.cgi replace subfunction "sub hook {...}"
with new one:

Code: Select all

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;
  }
}