summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortenderlove <tenderlove@ruby-lang.org>2013-08-26 22:41:44 +0000
committertenderlove <tenderlove@ruby-lang.org>2013-08-26 22:41:44 +0000
commit5bc6316b6eb083eafd87e7da7f484d08131669e6 (patch)
treee8d326c6fb99c034b5636341e36795f0966c6a0b /lib
parent5fbc3d096c7768aa1de7f39139d0c03b41210297 (diff)
downloadruby-openssl-history-5bc6316b6eb083eafd87e7da7f484d08131669e6.tar.gz
* io.c (io_read_nonblock): support non-blocking reads without raising
exceptions. As in: `io.read_nonblock(size, exception: false)` [ruby-core:38666] [Feature #5138] * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): ditto * ext/stringio/stringio.c (strio_sysread): ditto * io.c (rb_io_write_nonblock): support non-blocking writes without raising an exception. * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): ditto * test/openssl/test_pair.rb (class OpenSSL): tests * test/ruby/test_io.rb (class TestIO): ditto * test/socket/test_nonblock.rb (class TestSocketNonblock): ditto * test/stringio/test_stringio.rb (class TestStringIO): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/openssl/buffering.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/openssl/buffering.rb b/lib/openssl/buffering.rb
index 51bc968..e40dfee 100644
--- a/lib/openssl/buffering.rb
+++ b/lib/openssl/buffering.rb
@@ -161,7 +161,7 @@ module OpenSSL::Buffering
# when the peer requests a new TLS/SSL handshake. See openssl the FAQ for
# more details. http://www.openssl.org/support/faq.html
- def read_nonblock(maxlen, buf=nil)
+ def read_nonblock(maxlen, buf=nil, exception: true)
if maxlen == 0
if buf
buf.clear
@@ -171,7 +171,7 @@ module OpenSSL::Buffering
end
end
if @rbuffer.empty?
- return sysread_nonblock(maxlen, buf)
+ return sysread_nonblock(maxlen, buf, exception: exception)
end
ret = consume_rbuff(maxlen)
if buf
@@ -370,9 +370,9 @@ module OpenSSL::Buffering
# is when the peer requests a new TLS/SSL handshake. See the openssl FAQ
# for more details. http://www.openssl.org/support/faq.html
- def write_nonblock(s)
+ def write_nonblock(s, exception: true)
flush
- syswrite_nonblock(s)
+ syswrite_nonblock(s, exception: exception)
end
##