diff options
author | Eric Wong <e@80x24.org> | 2020-10-30 02:13:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-10-30 16:38:21 +0000 |
commit | c51c22c349529d9c377160abcc7961a6ca7b7d5c (patch) | |
tree | 99df405068988cdbd292bc9ac2dfdd6ec9737b7c /lib/PublicInbox/DS.pm | |
parent | 632d2c84efe004710bdf58048e348383a1644fea (diff) | |
download | public-inbox-c51c22c349529d9c377160abcc7961a6ca7b7d5c.tar.gz |
Apparently they happen (triggered by my -imapd instance), so bail out by closing the underlying socket rather than stopping the event loop and daemon process.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r-- | lib/PublicInbox/DS.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index d0caa5e7..a02b3bb7 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -433,7 +433,8 @@ next_buf: goto next_buf; } } elsif ($! == EAGAIN) { - epwait($sock, epbit($sock, EPOLLOUT) | EPOLLONESHOT); + my $ev = epbit($sock, EPOLLOUT) or return $self->close; + epwait($sock, $ev | EPOLLONESHOT); return 0; } else { return $self->close; @@ -469,7 +470,8 @@ sub do_read ($$$;$) { # common for clients to break connections without warning, # would be too noisy to log here: if ($! == EAGAIN) { - epwait($sock, epbit($sock, EPOLLIN) | EPOLLONESHOT); + my $ev = epbit($sock, EPOLLIN) or return $self->close; + epwait($sock, $ev | EPOLLONESHOT); rbuf_idle($self, $rbuf); 0; } else { @@ -543,7 +545,8 @@ sub write { return 1 if $written == $to_write; requeue($self); # runs: event_step -> flush_write } elsif ($! == EAGAIN) { - epwait($sock, epbit($sock, EPOLLOUT) | EPOLLONESHOT); + my $ev = epbit($sock, EPOLLOUT) or return $self->close; + epwait($sock, $ev | EPOLLONESHOT); $written = 0; } else { return $self->close; @@ -596,7 +599,8 @@ sub accept_tls_step ($) { my $sock = $self->{sock} or return; return 1 if $sock->accept_SSL; return $self->close if $! != EAGAIN; - epwait($sock, PublicInbox::TLS::epollbit() | EPOLLONESHOT); + my $ev = PublicInbox::TLS::epollbit() or return $self->close; + epwait($sock, $ev | EPOLLONESHOT); unshift(@{$self->{wbuf}}, \&accept_tls_step); # autovivifies 0; } @@ -607,7 +611,8 @@ sub shutdn_tls_step ($) { my $sock = $self->{sock} or return; return $self->close if $sock->stop_SSL(SSL_fast_shutdown => 1); return $self->close if $! != EAGAIN; - epwait($sock, PublicInbox::TLS::epollbit() | EPOLLONESHOT); + my $ev = PublicInbox::TLS::epollbit() or return $self->close; + epwait($sock, $ev | EPOLLONESHOT); unshift(@{$self->{wbuf}}, \&shutdn_tls_step); # autovivifies 0; } |