ruby-changes:45617
From: nobu <ko1@a...>
Date: Thu, 23 Feb 2017 10:15:33 +0900 (JST)
Subject: [ruby-changes:45617] nobu:r57690 (trunk): [DOC] {read, write}_nonblock with exception: false
nobu 2017-02-23 10:15:27 +0900 (Thu, 23 Feb 2017) New Revision: 57690 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57690 Log: [DOC] {read,write}_nonblock with exception: false Update docs to reflect EOF behavior change of read_nonblock and write_nonblock when using `exception: false`. [Fix GH-1527] Author: Russell Davis <russell-stripe@u...> Modified files: trunk/ext/openssl/lib/openssl/buffering.rb trunk/ext/openssl/ossl_ssl.c trunk/ext/socket/lib/socket.rb trunk/prelude.rb Index: prelude.rb =================================================================== --- prelude.rb (revision 57689) +++ prelude.rb (revision 57690) @@ -70,7 +70,8 @@ class IO https://github.com/ruby/ruby/blob/trunk/prelude.rb#L70 # # By specifying `exception: false`, the options hash allows you to indicate # that read_nonblock should not raise an IO::WaitReadable exception, but - # return the symbol :wait_readable instead. + # return the symbol :wait_readable instead. At EOF, it will return nil instead + # of raising EOFError. def read_nonblock(len, buf = nil, exception: true) __read_nonblock(len, buf, exception) end @@ -128,7 +129,8 @@ class IO https://github.com/ruby/ruby/blob/trunk/prelude.rb#L129 # # By specifying `exception: false`, the options hash allows you to indicate # that write_nonblock should not raise an IO::WaitWritable exception, but - # return the symbol :wait_writable instead. + # return the symbol :wait_writable instead. At EOF, it will return nil instead + # of raising EOFError. def write_nonblock(buf, exception: true) __write_nonblock(buf, exception) end Index: ext/openssl/ossl_ssl.c =================================================================== --- ext/openssl/ossl_ssl.c (revision 57689) +++ ext/openssl/ossl_ssl.c (revision 57690) @@ -1601,7 +1601,7 @@ ossl_ssl_connect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1601 * By specifying `exception: false`, the options hash allows you to indicate * that connect_nonblock should not raise an IO::WaitReadable or * IO::WaitWritable exception, but return the symbol :wait_readable or - * :wait_writable instead. + * :wait_writable instead. At EOF, it will return nil instead of raising EOFError. */ static VALUE ossl_ssl_connect_nonblock(int argc, VALUE *argv, VALUE self) @@ -1649,7 +1649,7 @@ ossl_ssl_accept(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1649 * By specifying `exception: false`, the options hash allows you to indicate * that accept_nonblock should not raise an IO::WaitReadable or * IO::WaitWritable exception, but return the symbol :wait_readable or - * :wait_writable instead. + * :wait_writable instead. At EOF, it will return nil instead of raising EOFError. */ static VALUE ossl_ssl_accept_nonblock(int argc, VALUE *argv, VALUE self) Index: ext/openssl/lib/openssl/buffering.rb =================================================================== --- ext/openssl/lib/openssl/buffering.rb (revision 57689) +++ ext/openssl/lib/openssl/buffering.rb (revision 57690) @@ -166,7 +166,8 @@ module OpenSSL::Buffering https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/buffering.rb#L166 # # By specifying `exception: false`, the options hash allows you to indicate # that read_nonblock should not raise an IO::Wait*able exception, but - # return the symbol :wait_writable or :wait_readable instead. + # return the symbol :wait_writable or :wait_readable instead. At EOF, it will + # return nil instead of raising EOFError. def read_nonblock(maxlen, buf=nil, exception: true) if maxlen == 0 @@ -378,7 +379,8 @@ module OpenSSL::Buffering https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/buffering.rb#L379 # # By specifying `exception: false`, the options hash allows you to indicate # that write_nonblock should not raise an IO::Wait*able exception, but - # return the symbol :wait_writable or :wait_readable instead. + # return the symbol :wait_writable or :wait_readable instead. At EOF, it will + # return nil instead of raising EOFError. def write_nonblock(s, exception: true) flush Index: ext/socket/lib/socket.rb =================================================================== --- ext/socket/lib/socket.rb (revision 57689) +++ ext/socket/lib/socket.rb (revision 57690) @@ -315,7 +315,8 @@ class BasicSocket < IO https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L315 # # By specifying `exception: false`, the _opts_ hash allows you to indicate # that sendmsg_nonblock should not raise an IO::WaitWritable exception, but - # return the symbol :wait_writable instead. + # return the symbol :wait_writable instead. At EOF, it will return nil instead + # of raising EOFError. def sendmsg_nonblock(mesg, flags = 0, dest_sockaddr = nil, *controls, exception: true) __sendmsg_nonblock(mesg, flags, dest_sockaddr, controls, exception) @@ -363,7 +364,8 @@ class BasicSocket < IO https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L364 # # By specifying `exception: false`, the options hash allows you to indicate # that recv_nonblock should not raise an IO::WaitWritable exception, but - # return the symbol :wait_writable instead. + # return the symbol :wait_writable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # * Socket#recvfrom @@ -437,7 +439,8 @@ class BasicSocket < IO https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L439 # # By specifying `exception: false`, the _opts_ hash allows you to indicate # that recvmsg_nonblock should not raise an IO::WaitWritable exception, but - # return the symbol :wait_writable instead. + # return the symbol :wait_writable instead. At EOF, it will return nil instead + # of raising EOFError. def recvmsg_nonblock(dlen = nil, flags = 0, clen = nil, scm_rights: false, exception: true) __recvmsg_nonblock(dlen, flags, clen, scm_rights, exception) @@ -514,7 +517,8 @@ class Socket < BasicSocket https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L517 # # By specifying `exception: false`, the options hash allows you to indicate # that accept_nonblock should not raise an IO::WaitReadable exception, but - # return the symbol :wait_readable instead. + # return the symbol :wait_readable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # * Socket#recvfrom @@ -571,7 +575,8 @@ class Socket < BasicSocket https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L575 # # By specifying `exception: false`, the options hash allows you to indicate # that accept_nonblock should not raise an IO::WaitReadable exception, but - # return the symbol :wait_readable instead. + # return the symbol :wait_readable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # * Socket#accept @@ -1190,7 +1195,8 @@ class Socket < BasicSocket https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L1195 # # By specifying `exception: false`, the options hash allows you to indicate # that connect_nonblock should not raise an IO::WaitWritable exception, but - # return the symbol :wait_writable instead. + # return the symbol :wait_writable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # # Socket#connect @@ -1248,7 +1254,8 @@ class UDPSocket < IPSocket https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L1254 # # By specifying `exception: false`, the options hash allows you to indicate # that recvmsg_nonblock should not raise an IO::WaitWritable exception, but - # return the symbol :wait_writable instead. + # return the symbol :wait_writable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # * Socket#recvfrom @@ -1289,7 +1296,8 @@ class TCPServer < TCPSocket https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L1296 # # By specifying `exception: false`, the options hash allows you to indicate # that accept_nonblock should not raise an IO::WaitReadable exception, but - # return the symbol :wait_readable instead. + # return the symbol :wait_readable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # * TCPServer#accept @@ -1330,7 +1338,8 @@ class UNIXServer < UNIXSocket https://github.com/ruby/ruby/blob/trunk/ext/socket/lib/socket.rb#L1338 # # By specifying `exception: false`, the options hash allows you to indicate # that accept_nonblock should not raise an IO::WaitReadable exception, but - # return the symbol :wait_readable instead. + # return the symbol :wait_readable instead. At EOF, it will return nil instead + # of raising EOFError. # # === See # * UNIXServer#accept -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/