mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@23006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b7800329d3
commit
c4049f4cb6
20 changed files with 208 additions and 70 deletions
|
@ -70,7 +70,7 @@ unix_accept(VALUE sock)
|
|||
* serv = UNIXServer.new("/tmp/sock")
|
||||
* begin # emulate blocking accept
|
||||
* sock = serv.accept_nonblock
|
||||
* rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
|
||||
* rescue IO::WaitReadable, Errno::EINTR
|
||||
* IO.select([serv])
|
||||
* retry
|
||||
* end
|
||||
|
@ -81,6 +81,10 @@ unix_accept(VALUE sock)
|
|||
*
|
||||
* UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure,
|
||||
* including Errno::EWOULDBLOCK.
|
||||
*
|
||||
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
|
||||
* it is extended by IO::WaitReadable.
|
||||
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
|
||||
*
|
||||
* === See
|
||||
* * UNIXServer#accept
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue