From 335a8321dc31a165676fb21f5464b7a11a37ce75 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 16 Jul 2018 11:46:20 +0000 Subject: use IO#pread if available in Ruby 2.5 In the future, this will allow sharing open files across different clients when serving static files. For now, it saves us one syscall. --- lib/yahns/openssl_client.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/yahns/openssl_client.rb') diff --git a/lib/yahns/openssl_client.rb b/lib/yahns/openssl_client.rb index c090083..d3caacb 100644 --- a/lib/yahns/openssl_client.rb +++ b/lib/yahns/openssl_client.rb @@ -93,10 +93,7 @@ module Yahns::OpenSSLClient # :nodoc: case buf = @ssl_blocked when nil - count = 0x4000 if count > 0x4000 - buf = Thread.current[:yahns_sfbuf] ||= ''.dup - io.pos = offset - buf = io.read(count, buf) or return # nil for EOF + buf = do_pread(io, count, offset) or return # nil for EOF buf = @ssl_blocked = buf.dup when Exception raise buf -- cgit v1.2.3-24-ge0c7