From df815ac5b2614f7278ca747750ea7e92ecd0986c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 28 Jun 2019 07:37:26 +0000 Subject: ds: consolidate IO::Socket::SSL checks We need to be careful about handling EAGAIN on write(2) failures deal with SSL_WANT_READ vs SSL_WANT_WRITE as appropriate. --- lib/PublicInbox/TLS.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/TLS.pm') diff --git a/lib/PublicInbox/TLS.pm b/lib/PublicInbox/TLS.pm index 576c11d7..0b9a55df 100644 --- a/lib/PublicInbox/TLS.pm +++ b/lib/PublicInbox/TLS.pm @@ -13,12 +13,9 @@ sub err () { $SSL_ERROR } # returns the EPOLL event bit which matches the existing SSL error sub epollbit () { - if ($! == EAGAIN) { - return EPOLLIN if $SSL_ERROR == SSL_WANT_READ; - return EPOLLOUT if $SSL_ERROR == SSL_WANT_WRITE; - die "unexpected SSL error: $SSL_ERROR"; - } - 0; + return EPOLLIN if $SSL_ERROR == SSL_WANT_READ; + return EPOLLOUT if $SSL_ERROR == SSL_WANT_WRITE; + die "unexpected SSL error: $SSL_ERROR"; } 1; -- cgit v1.2.3-24-ge0c7