… | |
… | |
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 => 4, parked => 1, |
|
|
84 | cb => \&Coro::schedule); |
|
|
85 | |
82 | |
86 | our %conn; # $conn{ip}{fh} => connobj |
83 | our %conn; # $conn{ip}{fh} => connobj |
87 | our %blocked; |
84 | our %blocked; |
88 | our %mimetype; |
85 | our %mimetype; |
89 | |
86 | |
… | |
… | |
483 | } else { |
480 | } else { |
484 | aio_read($fh, $l, ($h > $::BUFSIZE ? $::BUFSIZE : $h), |
481 | aio_read($fh, $l, ($h > $::BUFSIZE ? $::BUFSIZE : $h), |
485 | $buf, 0, sub { |
482 | $buf, 0, sub { |
486 | $r = $_[0]; |
483 | $r = $_[0]; |
487 | $current->ready; |
484 | $current->ready; |
488 | $scheduler->now; |
|
|
489 | }); |
485 | }); |
490 | &Coro::schedule; |
486 | &Coro::schedule; |
491 | last unless $r; |
487 | last unless $r; |
492 | } |
488 | } |
493 | my $w = $self->{fh}->syswrite($buf) |
489 | my $w = $self->{fh}->syswrite($buf) |