diff options
author | Eric Wong <e@80x24.org> | 2019-06-24 02:52:22 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-06-24 05:26:26 +0000 |
commit | ca05b93cddfa2cc495451410222af3753bfe1b4e (patch) | |
tree | a6a1b6c437341c82ab3545eeec926956ae76f05c /lib/PublicInbox/HTTPD/Async.pm | |
parent | dbcdabe601cfb29c8b7d5f169be9bf560d656a42 (diff) | |
download | public-inbox-ca05b93cddfa2cc495451410222af3753bfe1b4e.tar.gz |
We don't need to keep track of that field since we always know what events we're interested in when using one-shot wakeups.
Diffstat (limited to 'lib/PublicInbox/HTTPD/Async.pm')
-rw-r--r-- | lib/PublicInbox/HTTPD/Async.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm index dae62e55..f32ef009 100644 --- a/lib/PublicInbox/HTTPD/Async.pm +++ b/lib/PublicInbox/HTTPD/Async.pm @@ -31,10 +31,12 @@ sub new { $self; } +sub restart_read ($) { $_[0]->watch(PublicInbox::DS::EPOLLIN()) } + # fires after pending writes are complete: sub restart_read_cb ($) { my ($self) = @_; - sub { $self->watch_read(1) } + sub { restart_read($self) } } sub main_cb ($$$) { @@ -46,16 +48,16 @@ sub main_cb ($$$) { $fh->write($$bref); if ($http->{sock}) { # !closed if ($http->{wbuf}) { - $self->watch_read(0); + $self->watch(0); $http->write(restart_read_cb($self)); } - # stay in watch_read, but let other clients + # stay in EPOLLIN, but let other clients # get some work done, too. return; } # fall through to close below... } elsif (!defined $r) { - return if $!{EAGAIN} || $!{EINTR}; + return restart_read($self) if $!{EAGAIN} || $!{EINTR}; } # Done! Error handling will happen in $fh->close |