From 3c669e2be96b2584c8dd713fd4d2bd44bad11f9f Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 19 Mar 2009 11:40:38 +0000 Subject: * io.c (rb_mWaitReadable): defined. (rb_mWaitWritable): defined. (io_getpartial): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN. (rb_io_write_nonblock): extend IO::WaitWritable on EWOULDBLOCK and EAGAIN. * error.c (make_errno_exc): extracted from rb_sys_fail. (rb_mod_sys_fail): new function. * include/ruby/ruby.h (rb_mod_sys_fail): declared. (rb_mWaitReadable): declared. (rb_mWaitWritable): declared. * ext/socket/init.c (rsock_s_recvfrom_nonblock): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN. (rsock_s_accept_nonblock): extend IO::WaitReadable on EWOULDBLOCK, EAGAIN, ECONNABORTED and EPROTO. * ext/socket/socket.c (sock_connect_nonblock): extend IO::WaitWritable on EINPROGRESS. * ext/socket/ancdata.c (bsock_sendmsg_internal): extend IO::WaitWritable on EWOULDBLOCK and EAGAIN. (bsock_recvmsg_internal): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN. * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): raise SSLError extended by IO::WaitReadable/IO::WaitWritable on SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE. * ext/openssl/ossl.c (ossl_make_error): extracted from ossl_raise. (ossl_exc_new): new function. * ext/openssl/ossl.h (ossl_exc_new): declared. * lib/net/protocol.rb (rbuf_fill): rescue IO::WaitReadable and IO::WaitWritable. [ruby-core:22539], [ruby-dev:38140] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/openssl/test_pair.rb | 4 ++-- test/openssl/test_ssl.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/openssl') diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb index 9d22a87e2..e5beebc50 100644 --- a/test/openssl/test_pair.rb +++ b/test/openssl/test_pair.rb @@ -147,14 +147,14 @@ class OpenSSL::TestPair < Test::Unit::TestCase def test_read_nonblock ssl_pair {|s1, s2| err = nil - assert_raise(Errno::EWOULDBLOCK) { + assert_raise(OpenSSL::SSL::SSLError) { begin s2.read_nonblock(10) ensure err = $! end } - assert_match(/SSL_ERROR_WANT_READ/, err.message) + assert_kind_of(IO::WaitReadable, err) s1.write "abc\ndef\n" IO.select([s2]) assert_equal("ab", s2.read_nonblock(2)) diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 5053634a8..4688552cd 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -172,12 +172,12 @@ class OpenSSL::TestSSL < Test::Unit::TestCase ssl = OpenSSL::SSL::SSLSocket.new(sock) ssl.sync_close = true ssl.connect - assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK) { ssl.read_nonblock(100) } + assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) } ssl.write("abc\n") IO.select [ssl] assert_equal('a', ssl.read_nonblock(1)) assert_equal("bc\n", ssl.read_nonblock(100)) - assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK) { ssl.read_nonblock(100) } + assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) } } end -- cgit