From 99f85dd6fa80e650132b9373587e2963f6abd058 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Fri, 25 Aug 2017 20:26:09 +0900 Subject: [PATCH] ssl: remove useless call to rb_thread_wait_fd() That there is no immediately readable data in the SSL instance does not imply it has to read more bytes from the underlying socket. Just call SSL_read() and check the return value. --- ext/openssl/ossl_ssl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index f0462eda2..bf40c5b12 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -1700,8 +1700,6 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock) io = rb_attr_get(self, id_i_io); GetOpenFile(io, fptr); if (ssl_started(ssl)) { - if(!nonblock && SSL_pending(ssl) <= 0) - rb_thread_wait_fd(FPTR_TO_FD(fptr)); for (;;){ nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LENINT(str)); switch(ssl_get_error(ssl, nread)){