From: Tony Arcieri Date: 2009-03-10T15:58:48+09:00 Subject: [ruby-core:22802] Re: [Bug #814] NoMethodError: undefined method `read_nonblock' for # --000e0cd6a95c231a370464be4f5e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Thu, Feb 26, 2009 at 2:14 AM, Tanaka Akira wrote: > Does it care the I/O buffer implemented in > ext/openssl/lib/openssl/buffering.rb ? > I'm not certain. What exactly does this do? > What's happen if nonblocking methods and blocking methods are used both? > This (monkey) patch uses the core nonblocking functionality of OpenSSL, so it should be possible to use blocking and nonblocking methods interchangably. > Note that IO#read_nonblock reads from IO buffer if it is not empty. > IO#write_nonblock flushes IO buffer. > > See read_nonblock implementation in > ext/openssl/lib/openssl/buffering.rb in ruby-1.9.2dev. > What is the present behavior if IO#read_nonblock is called when the socket needs writable to continue? How are cases like SSL renegotiation presently handled? Different classes makes OpenSSL nonblocking methods and > IO/Socket nonblocking methods incompatible. > Yes, unfortunately the concerns of nonblocking SSL are different than they are from a standard socket. Standard nonblocking sockets never expect the socket need be ready for an I/O operation which wasn't requested. Unfortunately the requirements of SSL necessitate waiting on readability or writability regardless of which operation was requested. The socket may need to be writable in a case where read_nonblock was requested, and vice versa. > I think Errno::EWOULDBLOCK object extended by some module, > IO::WandRead or IO::WantWrite, is better. > I can certainly use those exceptions instead. -- Tony Arcieri medioh.com --000e0cd6a95c231a370464be4f5e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Thu, Feb 26, 2009 at 2:14 AM, Tanaka Akira <akr@fsij.org> wrote:
Does it care the I/O buffer implemented in
ext/openssl/lib/openssl/buffering.rb ?

I'm not certain.=A0 What exactly does this do?=A0
What's happen if nonblocking methods and blocking methods are used both= ?

This (monkey) patch uses the core nonblocking functio= nality of OpenSSL, so it should be possible to use blocking and nonblocking= methods interchangably.
=A0
Note that IO#read_nonblock reads from IO buffer if it is not empty. =A0IO#w= rite_nonblock flushes IO buffer.

See read_nonblock implementation in
ext/openssl/lib/openssl/buffering.rb in ruby-1.9.2dev.

What is the present behavior = if IO#read_nonblock is called when the socket needs writable to continue?= =A0 How are cases like SSL renegotiation presently handled?

Different classes makes OpenSSL nonblocking methods and
IO/Socket nonblocking methods incompatible.

Yes, unfortunately the concerns of nonblocking SSL ar= e different than they are from a standard socket.=A0 Standard nonblocking s= ockets never expect the socket need be ready for an I/O operation which was= n't requested.=A0 Unfortunately the requirements of SSL necessitate wai= ting on readability or writability regardless of which operation was reques= ted.=A0 The socket may need to be writable in a case where read_nonblock wa= s requested, and vice versa.
=A0
I think Errno::EWOULDBLOCK object extended by some module,
IO::WandRead or IO::WantWrite, is better.

I can certainly use those exceptions instead.=

--
Tony Arcieri
medioh.com=
--000e0cd6a95c231a370464be4f5e--