… | |
… | |
76 | |
76 | |
77 | Linux::AIO::min_parallel $::AIO_PARALLEL; |
77 | Linux::AIO::min_parallel $::AIO_PARALLEL; |
78 | |
78 | |
79 | Event->io(fd => Linux::AIO::poll_fileno, |
79 | Event->io(fd => Linux::AIO::poll_fileno, |
80 | poll => 'r', async => 1, |
80 | poll => 'r', async => 1, |
81 | cb => \&Linux::AIO::poll_cb ); |
81 | cb => \&Linux::AIO::poll_cb); |
|
|
82 | my $scheduler = Event->idle( |
|
|
83 | max => 0, min => 0, prio => 6, parked => 1, |
|
|
84 | cb => \&Coro::schedule); |
82 | |
85 | |
83 | our %conn; # $conn{ip}{fh} => connobj |
86 | our %conn; # $conn{ip}{fh} => connobj |
84 | our %blocked; |
87 | our %blocked; |
85 | our %mimetype; |
88 | our %mimetype; |
86 | |
89 | |
… | |
… | |
480 | } else { |
483 | } else { |
481 | aio_read($fh, $l, ($h > $::BUFSIZE ? $::BUFSIZE : $h), |
484 | aio_read($fh, $l, ($h > $::BUFSIZE ? $::BUFSIZE : $h), |
482 | $buf, 0, sub { |
485 | $buf, 0, sub { |
483 | $r = $_[0]; |
486 | $r = $_[0]; |
484 | $current->ready; |
487 | $current->ready; |
|
|
488 | $scheduler->now; |
485 | }); |
489 | }); |
486 | &Coro::schedule; |
490 | &Coro::schedule; |
487 | last unless $r; |
491 | last unless $r; |
488 | } |
492 | } |
489 | my $w = $self->{fh}->syswrite($buf) |
493 | my $w = $self->{fh}->syswrite($buf) |