… | |
… | |
6 | use HTTP::Date; |
6 | use HTTP::Date; |
7 | |
7 | |
8 | no utf8; |
8 | no utf8; |
9 | use bytes; |
9 | use bytes; |
10 | |
10 | |
11 | our @wait_time = (0); # used to calculcate avg. waiting time |
11 | our @wait_time = (); # used to calculcate avg. waiting time |
|
|
12 | our $wait_time_length = 25; |
12 | |
13 | |
13 | # at least on my machine, this thingy serves files |
14 | # at least on my machine, this thingy serves files |
14 | # quite a bit faster than apache, ;) |
15 | # quite a bit faster than apache, ;) |
15 | # and quite a bit slower than thttpd :( |
16 | # and quite a bit slower than thttpd :( |
16 | |
17 | |
… | |
… | |
485 | |
486 | |
486 | my $transfer = $::transfers->guard; |
487 | my $transfer = $::transfers->guard; |
487 | $self->{fh}->writable or return; |
488 | $self->{fh}->writable or return; |
488 | |
489 | |
489 | push @::wait_time, $::NOW - $self->{time}; |
490 | push @::wait_time, $::NOW - $self->{time}; |
490 | shift @::wait_time if @wait_time > 25; |
491 | shift @::wait_time if @wait_time > $wait_time_length; |
491 | $self->{time} = $::NOW; |
492 | $self->{time} = $::NOW; |
492 | |
493 | |
493 | my ($fh, $buf, $r); |
494 | my ($fh, $buf, $r); |
494 | my $current = $Coro::current; |
495 | my $current = $Coro::current; |
495 | open $fh, "<", $self->{path} |
496 | open $fh, "<", $self->{path} |