From ca05b93cddfa2cc495451410222af3753bfe1b4e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jun 2019 02:52:22 +0000 Subject: ds: get rid of event_watch field 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. --- lib/PublicInbox/HTTPD/Async.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/HTTPD/Async.pm') 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 -- cgit v1.2.3-24-ge0c7